随笔分类 -  挑战程序设计竞赛 - 数据结构及算法

摘要:1 #include 2 #include 3 4 using namespace std; 5 static const int N = 100; 6 static const int INFTY = (1 q; 14 q.push(s); 15 for (int i = 0;i < n;i++ ) d[i] = INFTY; 16 d[s... 阅读全文
posted @ 2018-03-31 00:01 Dicer 阅读(165) 评论(0) 推荐(0)
摘要:1 #include 2 #define MAX 5000003 3 #define SENTINEL 2000000000 4 using namespace std; 5 6 int L[MAX / 2 + 2], R[MAX / 2 + 2]; 7 int cnt; 8 9 void merge (int A[], int left, int... 阅读全文
posted @ 2018-03-11 17:39 Dicer 阅读(124) 评论(0) 推荐(0)
摘要:题目链接 :https://vjudge.net/problem/Aizu-ALDS1_5_A 穷举搜索 阅读全文
posted @ 2018-03-10 14:00 Dicer 阅读(141) 评论(0) 推荐(0)
摘要:分治法的基本思想:是将一个规模为n的原问题分解为k个规模较小的子问题,这些子问题互相独立且与原问题相同。递归地解这些子问题,然后将子问题的解合并为原问题的解。 阅读全文
posted @ 2018-03-09 11:59 Dicer 阅读(284) 评论(0) 推荐(0)
摘要:在c++中封装好的stack,queue,list,vector中使用迭代器 定义 如vector<int>::iterator it; 数组用指针,已封装好的结构体用迭代器; lower_bound采用二分搜索; begin():返回指向容器开头的迭代器; end():返回指向容器末尾的迭代器,这 阅读全文
posted @ 2018-03-09 10:22 Dicer 阅读(335) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 5 void print(vector V) //输出函数 6 { 7 for (int i = 0;i V; 17 18 V.push_back(0.1); ... 阅读全文
posted @ 2018-03-08 16:19 Dicer 阅读(151) 评论(0) 推荐(0)
摘要:题目链接:https://vjudge.net/problem/Aizu-ALDS1_3_B 阅读全文
posted @ 2018-03-08 16:08 Dicer 阅读(183) 评论(0) 推荐(0)
摘要:题目链接 : https://vjudge.net/problem/Aizu-ALDS1_3_A 注 :刚学STL就用STL写了,STL还是很方便的 阅读全文
posted @ 2018-03-07 22:21 Dicer 阅读(147) 评论(0) 推荐(0)
摘要:题目链接 : https://vjudge.net/problem/Aizu-ALDS1_3_C 注 :双向链表 阅读全文
posted @ 2018-03-05 16:39 Dicer 阅读(170) 评论(0) 推荐(0)