摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1720题目:http://acm.hdu.edu.cn/showproblem.php?pid=2057代码是同一个:简单的想哭。。。想了好复杂;#include int main() { int a,b; while(scanf("%x%x",&a,&b)!=EOF) { printf("%d\n",a+b); } return 0; }2057要用%I64X;在这里 你要明白的是 计算机存入的数据是二进制 0 1 所以scanf("% 阅读全文
posted @ 2012-12-05 22:49 简洁是智慧的灵魂 阅读(829) 评论(0) 推荐(0)
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1272AC代码:#include #include #include #define maxn 100001 using namespace std; int set[maxn],num[maxn]; int find(int x) { if(set[x] == x)return x; return set[x] = find(set[x]); } int main() { int n,m,pos; while(scanf("%d%d",&n,&m)) { if(m= 阅读全文
posted @ 2012-12-05 22:20 简洁是智慧的灵魂 阅读(105) 评论(0) 推荐(0)
摘要: 并查集还是挺简单的,路径压缩,按秩合并(这个很麻烦,建议了解就好,主要是路径压缩,我写的代码也只是普通的合并);前天学的,要练练手,以防生疏;http://acm.hdu.edu.cn/showproblem.php?pid=1232#include #include #define maxn 10010 #define INF 999999999 using namespace std; int map[maxn][maxn],set[maxn]; int find(int x) { if(set[x] == x)return x; return set[x] = find(set... 阅读全文
posted @ 2012-12-05 20:03 简洁是智慧的灵魂 阅读(141) 评论(0) 推荐(0)
摘要: 思想一开始就对了,不过在置无穷大的时候犯了个错误,这个题目的路程距离dis是double型的,以前写的都是int 类型的,置无穷大都是用memset(map,0x3f,sizeof(map));怪我乱来,double也这么置无穷大,结果就出错了。当然题目还是典型的最小生成树问题,练练手,不然忘记了;。。。畅通工程再续Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8223Accepted Submission(s): 2494Problem D 阅读全文
posted @ 2012-12-05 19:33 简洁是智慧的灵魂 阅读(115) 评论(0) 推荐(0)