摘要: 局部静态对象在程序的执行路径第一次经过对象定义语句时初始化,并且直到程序终止才被销毁。 一个例子: 以上程序执行的结果为: 而使用静态变量: 结果为: 可以发现,static的变量在当前块结束之后也还是有效的。 阅读全文
posted @ 2017-03-17 10:01 codinRay 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 头文件 构造 成员函数 li.begin() li.end() li.rbegin() li.rend() assign() front(),back() 返回第一个/最后一个元素 empty() 返回list是否为空 size() 返回list元素个数,max_size() 返回最大个数 clea 阅读全文
posted @ 2017-03-16 16:06 codinRay 阅读(596) 评论(0) 推荐(1) 编辑
摘要: 头文件 建立 此时,默认键值更大的数具有高优先级。 调整优先级 阅读全文
posted @ 2017-03-16 15:26 codinRay 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; vector heap{ 3,1,2,5,7,8,4,9,6 }; void Max_Heapify(vector &heap, int root, int tail) { int FatherNode = root, &p = FatherNode; int lch = p *... 阅读全文
posted @ 2017-03-14 21:00 codinRay 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 题 : https://www.patest.cn/contests/gplt/L2-006 阅读全文
posted @ 2017-03-12 21:06 codinRay 阅读(211) 评论(0) 推荐(0) 编辑
摘要: void solve(int start,int end,int root) { // 前序和中序 -> 后序 // 每次调用solve()函数,传入pre-order的start,end,root if (start > end) // 递归边界 return; int i = start; while (i 前序 // 每次调用sol... 阅读全文
posted @ 2017-03-12 20:19 codinRay 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 传送门 : https://www.patest.cn/contests/gplt/L2-010 朋友之间的关系和敌对的关系分别用并查集和二维数组储存。 AC code : 阅读全文
posted @ 2017-03-09 21:44 codinRay 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 题目传送门 : http://acm.hdu.edu.cn/showproblem.php?pid=1232 并查集的裸题 AC code: 阅读全文
posted @ 2017-03-09 21:38 codinRay 阅读(135) 评论(0) 推荐(0) 编辑
摘要: int pre[MAXN]; int Find(int pos) { if (pre[pos] == pos) // pre是自己,代表为root节点 return pos; int r = pos; while (r != pre[r]) // 找到节点pos的root r = pre[r]; // 路径压缩 ... 阅读全文
posted @ 2017-03-09 19:46 codinRay 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 饭卡 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 26586 Accepted Submission(s): 9293 Problem Des 阅读全文
posted @ 2017-03-08 09:19 codinRay 阅读(180) 评论(0) 推荐(0) 编辑