随笔分类 -  数据结构

摘要:包含在c++<algorithm>库中的next_permutation(arr,arr+n)函数可以实现arr中元素的全排列 但是要求arr中元素事先已经按字典序排列好 具体使用方法如下: 阅读全文
posted @ 2016-07-13 08:43 相儒以沫 阅读(1792) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 int father[2010];10 int offset[2010];11 int flag;12 13 voi... 阅读全文
posted @ 2015-08-17 19:42 相儒以沫 阅读(222) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 priority_queuepq;10 int an[3100];11 int bn[3100];12 13 int... 阅读全文
posted @ 2015-08-17 14:59 相儒以沫 阅读(197) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 priority_queue,greater >pq2; 9 priority_queue pq1;10 11 int main()12 {... 阅读全文
posted @ 2015-08-17 12:56 相儒以沫 阅读(352) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 vector used; 9 int father[101000];10 11 int main()12 {13 int time=... 阅读全文
posted @ 2015-08-17 09:50 相儒以沫 阅读(126) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 char target[10000]; 8 char source[10000]; 9 int arr[10000];10 11 int main()12 {13 ... 阅读全文
posted @ 2015-08-17 09:48 相儒以沫 阅读(126) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 short has[25000010]; 8 9 int main()10 {11 long long ans=0;12 int a1,a2,a3... 阅读全文
posted @ 2015-08-17 09:43 相儒以沫 阅读(160) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 multiset smin; 9 multiset smax; 10 multiset::iterator it; 11 ... 阅读全文
posted @ 2015-08-14 19:13 相儒以沫 阅读(549) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct point 9 { 10 double x, y; 11 point( double _x ... 阅读全文
posted @ 2015-08-10 19:57 相儒以沫 阅读(105) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 int father[100010]; 9 int num[100010];10 11 int main()12 {13 int a... 阅读全文
posted @ 2015-08-10 18:27 相儒以沫 阅读(113) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 int father[1010]; 9 int num[1010];10 11 int main()12 {13 int n,m;1... 阅读全文
posted @ 2015-08-10 16:09 相儒以沫 阅读(116) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 struct Node 8 { 9 char c;10 Node* next;11 Node(){next=NULL;}12 };13 14... 阅读全文
posted @ 2015-08-07 14:07 相儒以沫 阅读(148) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 4 using namespace std; 5 6 set arr; 7 8 int main() 9 {10 int i=1;11 arr.insert(1);12 long long s;13 for(... 阅读全文
posted @ 2015-08-04 09:10 相儒以沫 阅读(111) 评论(0) 推荐(0)
摘要:stack先入先出可用函数empty(); //判断栈空size(): //返回栈的大小top(); //返回栈顶元素push(): //入栈pop(); //出栈 阅读全文
posted @ 2015-08-04 08:37 相儒以沫 阅读(118) 评论(0) 推荐(0)
摘要:queuequeue先进先出可用函数empty(); //判断队列是否为空size(); //返回队列大小top(); //返回队首元素back(); //返回队尾元素push(); //入队pop(); //出队priority_queue优先化队列队首元素最大或最小默认队首最大pri... 阅读全文
posted @ 2015-08-03 20:31 相儒以沫 阅读(127) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 map arr;11 vector word;12 13 string change(str... 阅读全文
posted @ 2015-08-03 16:27 相儒以沫 阅读(158) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 vector arr[30]; 10 int x,y,n; 11 void find_blocks... 阅读全文
posted @ 2015-08-03 15:29 相儒以沫 阅读(132) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 using namespace std;10 11 set arr;12 13 int main()14 {15 ... 阅读全文
posted @ 2015-08-03 15:23 相儒以沫 阅读(391) 评论(0) 推荐(0)