上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 47 下一页

2012年5月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2112把地名和数字对应一下,就变成模板题了#include #include using namespace std;const int INF=10000000;const int maxn=101;int ni... 阅读全文
posted @ 2012-05-13 12:45 LegendaryAC 阅读(309) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1874第一次知道有个东西叫重边。。。囧View Code #include #include using namespace std;const int INF=1000000000;int map[210][21... 阅读全文
posted @ 2012-05-13 03:15 LegendaryAC 阅读(150) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2544在TCO又一次0之后。。。突然会写最短路了,ORZView Code #include #include using namespace std;const int INF=100000000;int map... 阅读全文
posted @ 2012-05-13 02:59 LegendaryAC 阅读(167) 评论(0) 推荐(0) 编辑

2012年5月11日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1541画星星,注意要把所有点向右平移一位,否则update会死循环(在(0,0))ps:数组一定要开够啊啊啊View Code #include <stdio.h>#include <string.h>const int maxn1=15001;const int maxn2=32001;int n;int tree[maxn2],ans[maxn1];int lowbit(int i){ return i&(-i);}void update(int i,int val){ w 阅读全文
posted @ 2012-05-11 19:23 LegendaryAC 阅读(138) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1678继续是STL的堆,这道题最小堆最大堆均可,随手写一个就ok。刚开始题意理解有问题,各种wa,郁闷得要死。从最小堆来看,三个一组最小的加到答案里。如果元素总数不能被3整除,就先把堆顶元素出堆,直到能被3整除为止。View Code #include <iostream>#include <queue>#include <algorithm>using namespace std;int main(){ int t,n,p; int ans; priority_queue 阅读全文
posted @ 2012-05-11 12:06 LegendaryAC 阅读(228) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4006第一反应是线段树,不过发现k是固定的。用STL的优先队列,很爽。http://blog.chinaunix.net/space.php?uid=533684&do=blog&cuid=2615612我从上面的博客学到很多STL优先队列的知识,ORZ一个View Code #include <iostream>#include <vector>#include <queue>using namespace std;int main(){ int n,k, 阅读全文
posted @ 2012-05-11 00:57 LegendaryAC 阅读(196) 评论(0) 推荐(0) 编辑

2012年5月10日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4079比大小的题。。。没用条件给一堆。。。View Code #include <iostream>#include <map>#include <string>#include <algorithm>using namespace std;typedef struct L{ int start,during;}L;L phone[11000];int main(){ int n,m,i,j; int start,during; int ans; while(s 阅读全文
posted @ 2012-05-10 18:05 LegendaryAC 阅读(247) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1027求数列n的第m个排列,STL中next_permutation的应用。相对应的还有prev_permutation。View Code #include #include #include #include using namespace std;int main(){ int n,m,i; int s[1100]; while(~scanf("%d%d",&n,&m)) { for(i=1;iusing namespace std ;int n,m ;int vi. 阅读全文
posted @ 2012-05-10 17:08 LegendaryAC 阅读(194) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1263STL中map的练习View Code #include <iostream>#include <map>#include <string>using namespace std;int main(){ int n,m,k,i; int f=0; scanf("%d",&n); while(n--) { if(!f)f++; else putchar('\n'); map <string ,map<string, 阅读全文
posted @ 2012-05-10 16:35 LegendaryAC 阅读(257) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1075趁着HDOJ活了赶快交一个、、、刚开始学习STL的应用,这个代码学习自sx老祖。。。View Code #include <stdio.h> #include <iostream> #include <string> #include <map>using namespace std; int main(){ int i; char str[3001]; map <string,string> M; string str1,str2; cin 阅读全文
posted @ 2012-05-10 12:46 LegendaryAC 阅读(227) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 47 下一页