上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

2012年8月16日

最大公约数

摘要: View Code 1 #include<stdio.h> 2 int gcd(int x,int y) 3 { 4 int r; 5 while(y!=0) 6 { 7 r=x%y; 8 x=y; 9 y=r;10 }11 return x;12 }13 int main()14 {15 int a,b;16 while(~scanf("%d%d",&a,&b))17 {18 printf("%d\n",gcd(a,b));19 }20 } 阅读全文

posted @ 2012-08-16 21:22 仁者无敌8勇者无惧 阅读(124) 评论(0) 推荐(0) 编辑

欧拉函数

摘要: View Code 1 #include<stdio.h> 2 int Eular(int n) 3 { 4 int i; 5 int ans=n; 6 for(i=2;i*i<=n;++i) 7 { 8 if(n%i==0) //如果i和n不互质,i的倍数全都与n不互质 9 {10 ans-=ans/i; //排除掉i的倍数11 while(n%i==0)12 n=n/i; //去掉n中含有的所有i因子13 ... 阅读全文

posted @ 2012-08-16 21:15 仁者无敌8勇者无惧 阅读(278) 评论(0) 推荐(0) 编辑

2012年8月15日

hdu 1874 畅通工程续

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1874畅通工程续Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13969Accepted Submission(s): 4737Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 阅读全文

posted @ 2012-08-15 21:14 仁者无敌8勇者无惧 阅读(191) 评论(0) 推荐(0) 编辑

2012年8月14日

hdu 1162Eddy's picture

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1162Eddy's pictureTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4199Accepted Submission(s): 2061Problem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a pai 阅读全文

posted @ 2012-08-14 10:43 仁者无敌8勇者无惧 阅读(224) 评论(0) 推荐(0) 编辑

2012年8月13日

hdu 3371Connect the Cities

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3371View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int root[510]; 5 struct Node 6 { 7 int start,end; 8 int len; 9 }node[25010];10 int cmp(const void*x,const void*y)11 {12 return (*(Node*)x).len-(*(Node*)y).len;13 阅读全文

posted @ 2012-08-13 21:44 仁者无敌8勇者无惧 阅读(121) 评论(0) 推荐(0) 编辑

hdu 1233还是畅通工程

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1233View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define INIT 0x7ffffff 5 int Graph[110][110]; 6 int vis[110],dis[110]; 7 int town,road; 8 int sum; 9 int count;10 void prime()11 {12 memset(vis,0,sizeof(vis));13 阅读全文

posted @ 2012-08-13 16:48 仁者无敌8勇者无惧 阅读(119) 评论(0) 推荐(0) 编辑

2012年8月11日

hdu 并查集专题

摘要: http://acm.hdu.edu.cn/diy/contest_show.php?cid=165621.How Many TablesView Code 1 #include<stdio.h> 2 int root[1001]; 3 int find(int x) 4 { 5 int r=x; 6 while(r!=root[r]) 7 r=root[r]; 8 int i=x,j; 9 /*10 while(i!=r)11 {12 j=root[i];13 root[i]=r;14 ... 阅读全文

posted @ 2012-08-11 16:47 仁者无敌8勇者无惧 阅读(225) 评论(0) 推荐(0) 编辑

hdu 1863畅通工程

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1863畅通工程Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9952Accepted Submission(s): 3929Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编 阅读全文

posted @ 2012-08-11 16:23 仁者无敌8勇者无惧 阅读(146) 评论(0) 推荐(0) 编辑

hdu 2473Junk-Mail Filter

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2473Junk-Mail FilterTime Limit: 15000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3948Accepted Submission(s): 1197Problem DescriptionRecognizing junk mails is a tough task. The method used here consists of two steps:1) 阅读全文

posted @ 2012-08-11 13:21 仁者无敌8勇者无惧 阅读(227) 评论(0) 推荐(0) 编辑

2012年8月10日

并查集

摘要: http://hi.baidu.com/344847199/blog/item/79092f1fec9527d2a78669a5.html 阅读全文

posted @ 2012-08-10 16:56 仁者无敌8勇者无惧 阅读(105) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

导航