- 博客(20)
- 收藏
- 关注
原创 1076. Forwards on Weibo (30)
1076. Forwards on Weibo (30)时间限制3000 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueWeibo is known as the Chinese version o
2017-08-30 17:52:43 266
原创 pat图
图的遍历:A1122A1013A1021A1034A1076A1134A1114A1139A1042最短路径:A1003A1018A1030A1072A1087A1111
2017-08-30 17:46:34 251
转载 1034. Head of a Gang (30)
1034. Head of a Gang (30)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueOne way that the police finds the head of a
2017-08-29 16:50:06 311
原创 pat树
A1020A1086A1102A1110A1119A1079A1090A1094A1106A1004A1053A1043A1064A1099A1115A1127A1123A1130A1135A1143
2017-08-29 11:03:26 521 4
转载 堆
参照浙大MOOC数据结构void Swap( ElementType *a, ElementType *b ){ ElementType t = *a; *a = *b; *b = t;} void PercDown( ElementType A[], int p, int N ){ /* 改编代码4.24的PercDown( MaxHeap H, int p )
2017-08-25 18:20:22 249
原创 位运算 题目
写出函数中缺失的部分,使得函数返回值为一个整数,该整数的第i位和m的第i位相同,其他位和n相同。请使用【一行代码】补全bitManipulation1函数使得程序能达到上述的功能#include using namespace std;int bitManipulation1(int n, int m, int i) {// 在此处补充你的代码}int
2017-08-15 18:00:27 2644 2
转载 reverse()
参照算法笔记P233#include#include#include#includeusing namespace std;int main(){ int a[6]={10,11,12,13,14,15}; reverse(a,a+4); //将a[0]-a[3]反转 int i; for(i=0;i<6;i++){ printf("%d ",a[i]);
2017-08-13 19:05:40 204
转载 priority_queue
参照算法笔记P221#include//priority_queueq 大顶堆 #include//priority_queue,greater >q 小顶堆 using namespace std; int main(){ int n,x,i; while(scanf("%d",&n)!=EOF){ priority_qu
2017-08-12 18:18:31 201
转载 queue
参照算法笔记P218#include#includeusing namespace std;int main(){ queue q; int i; for(i=0;i<5;i++){ q.push(i); } printf("%d %d\n",q.front(),q.back()); q.pop(); printf("%d %d\n",q.front(),q.b
2017-08-11 19:42:14 171
转载 map
参照算法笔记P213#include#include //map mp; using namespace std;map mp;int main(){ mp['m']=20; mp['r']=30; mp['a']=40; map::iterator it=mp.begin(); for(;it!=mp.end();it++){ printf("%c %d\n",
2017-08-10 19:52:56 225
转载 string
参照算法笔记P202#include#includeusing namespace std;int main(){ string s1="abc"; string s2="def"; string s3=s1+s2; cout等比较,比较规则是 字典序 string s4="abcxyz",s5="opq"; s4.insert(3,s5); //insert(p
2017-08-09 19:58:08 172
转载 set
参照算法笔记 P197#include#include // 从小到大 且 不重复 using namespace std; //set nameint main(){ set st; st.insert(3); //insert()插入元素 st.insert(2); st.insert(5); st.insert(3); set::iterator it=st.
2017-08-08 19:26:48 145
转载 vector
参照算法笔记P191#include#include//vector nameusing namespace std; vector a;int main(){ int i; for(i=0;i<5;i++){ a.push_back(i); //在vector后面添加元素 } printf("%d ",a.size()); //获取vector元素个数
2017-08-04 20:00:58 144
转载 二分查找
参照算法笔记P126Shopping in Mars (25)Find Coins (25)#include//普通二分 int binarySearch(int A[],int left,int right,int x){//[0,n-1] int mid; while(left<=right){ mid=(left+right)/2; if(A[
2017-08-03 20:40:32 178
转载 C++字符串输入
参照算法笔记P75char str[1000];cin.getline(str,100);string str;getline(cin,str);
2017-08-02 20:40:00 162
原创 1015. Reversible Primes (20)
1015. Reversible Primes (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA reversible prime in any number system
2017-08-01 19:36:44 203
原创 1116. Come on! Let's C (20)
1116. Come on! Let's C (20)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue"Let's C" is a popular and fun programmin
2017-08-01 19:28:29 207
转载 第四周
雇佣兵的体力最大值为M,初始体力值为0、战斗力为N、拥有X个能量元素。当雇佣兵的体力值恰好为M时,才可以参加一个为期M天的战斗期,战斗期结束体力值将为0。在同一个战斗期内,雇佣兵每连续战斗n天,战斗力就会上升1点,n为当前战斗期开始时的战斗力。一个战斗期结束后,雇佣兵需要用若干个能量元素使其体力恢复到最大值M,从而参加下一个战斗期。每个能量元素恢复的体力值不超过当前的战斗力。每个能
2017-08-01 14:10:47 587 3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人