随笔分类 -  2012-1000系列

上一页 1 ··· 6 7 8 9 10 11 12 13 下一页

 
HDU 2192 MagicBuilding
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2192求出现的最多的那个数字出现的次数参考祖宗的方法搞的,排序+扫。View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)a-*(int*)b;}int a[11000];int main(){ int t,n,i; int s,ans; scanf("%d",&t); 阅读全文
posted @ 2012-04-19 15:39 LegendaryAC 阅读(205) 评论(0) 推荐(0)
HDU 1691 Chinese Chess
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1691博客里面不好骂人,所以就不说太多了。有几点注意:1、象可能跑到不可能达到的位置2、兵要判断后退这种情况View Code 1 #include <stdio.h> 2 3 int map[20][20]; 4 int Kinga,Kingb;//红王坐标 5 int Kingc,Kingd;//黑王坐标 6 int abs(int a){return a>0?a:-a;} 7 int KingFaceToFace()//两王是否相对 8 { 9 int i; 10 ... 阅读全文
posted @ 2012-04-19 11:46 LegendaryAC 阅读(406) 评论(0) 推荐(0)
HDU 3352 Tiles of Tetris, NOT!
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3352View Code #include <stdio.h>int gcd(int a,int b){ return a%b==0?b:gcd(b,a%b);}__int64 lcg(int a,int b){ return (__int64)a*(__int64)b/(__int64)gcd(a,b)/(__int64)gcd(a,b);} int main(){ int a,b; while(scanf("%d%d",&a,&b),(a||b)) prin 阅读全文
posted @ 2012-04-19 01:55 LegendaryAC 阅读(228) 评论(0) 推荐(0)
HDU 1673 Optimal Parking
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1673阅读题View Code #include <stdio.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)a-*(int*)b;}int main(){ int t,n,i; int x[30]; scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=0;i<n;i++) sca 阅读全文
posted @ 2012-04-18 21:29 LegendaryAC 阅读(274) 评论(0) 推荐(0)
HDU 1279 验证角谷猜想
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1279按要求模拟View Code #include <stdio.h>int main(){ int t,n,p,f,f1; scanf("%d",&t); while(t--) { f=f1=1; scanf("%d",&n); p=n; while(n) { if(n%2&&n!=1){ f1=0; break; ... 阅读全文
posted @ 2012-04-17 00:13 LegendaryAC 阅读(211) 评论(0) 推荐(0)
HDU 1071 The area
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1071按要求求出面积即可View Code #include <stdio.h>int main(){ int t; double x0,y0,x1,y1,x2,y2; double k,b; double a; double s; scanf("%d",&t); while(t--) { scanf("%lf%lf%lf%lf%lf%lf",&x0,&y0,&x1,&y1,&x2,&y2); k=(y 阅读全文
posted @ 2012-04-16 23:39 LegendaryAC 阅读(194) 评论(0) 推荐(0)
HDU 4218 IMBA?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4218不用删最后的空格,fuckView Code #include <stdio.h>#include <math.h>int main(){ int t,r,a; int i,j; int nCase=1; scanf("%d",&t); while(t--) { scanf("%d",&r); a=2*r+1; printf("Case %d:\n",nCase++); for(i=0;i<a;i+ 阅读全文
posted @ 2012-04-16 21:51 LegendaryAC 阅读(173) 评论(0) 推荐(0)
HDU 4223 Dynamic Programming?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4223View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#define INF 100000000int cmp(const void*a,const void*b){ return *(int*)a-*(int*)b;}int a[110000],s[110000];int main(){ int t,n; int i; int min; int nCase=1; scanf("% 阅读全文
posted @ 2012-04-16 21:46 LegendaryAC 阅读(194) 评论(0) 推荐(0)
HDU 1003 Max Sum
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1003靠,总算过了,不解释View Code #include <stdio.h>#include <stdlib.h>int a[110000];int main(){ int t,n; int i,f; int max,now; int start,end; int temp; int nCase=1; scanf("%d",&t); f=0; while(t--) { scanf("%d",&n); scanf(" 阅读全文
posted @ 2012-04-16 18:47 LegendaryAC 阅读(143) 评论(0) 推荐(0)
HDU 4221 Greedy?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4221哎,这么简单一道题,愁View Code #include <stdio.h>#include <stdlib.h>typedef struct L{ __int64 c,d;}L;L kk[110000];int cmp(const void*a,const void*b){ return (*(L*)a).d-(*(L*)b).d;}int main(){ int t,n; int i; __int64 time,py; int nCase=1; scanf... 阅读全文
posted @ 2012-04-15 21:13 LegendaryAC 阅读(209) 评论(0) 推荐(0)
HDU 1205 吃糖果
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1205max为最大堆数量,s为总数。保证max-(s-max)=2*max-s<=1即可,因为只要能保证最大堆数量和其他堆数量差在一个以内,就可以做到别的堆拿一个最大堆拿一个(剩下yy)这种操作。View Code #include <stdio.h>int a[1100000];int main(){ int t,n; int i; __int64 s; int max; scanf("%d",&t); while(t--) { s=max=0; ... 阅读全文
posted @ 2012-04-14 19:08 LegendaryAC 阅读(392) 评论(0) 推荐(0)
HDU 2540 遮挡判断
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2540只要影子长度大于前面的所有影子长度就okView Code #include <stdio.h>#include <stdlib.h>typedef struct node{ int x,h;}node;node kk[110000];int cmp(const void*a,const void*b){ return (*(node*)a).x-(*(node*)b).x;}int main(){ int n,i; int A,T; while(scanf("%d&q 阅读全文
posted @ 2012-04-14 10:16 LegendaryAC 阅读(231) 评论(0) 推荐(0)
HDU 2108 Shape of HDU
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2108几何计算,判断线段的转向。View Code #include <stdio.h>#include <string.h>#include <math.h>typedef struct point{ int x,y; }point;point kk[100000];int dis(point p1,point p2,point p3){ return (p3.x-p1.x)*(p2.y-p1.y)-(p2.x-p1.x)*(p3.y-p1.y);}int main(){ 阅读全文
posted @ 2012-04-13 23:29 LegendaryAC 阅读(187) 评论(0) 推荐(0)
HDU 3783 ZOJ
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3783View Code #include <stdio.h>#include <stdlib.h>#include <string.h> int main(){ int n,i; int cntZ,cntO,cntJ; int len; char str[200]; while(gets(str)) { if(str[0]=='E')break; len=strlen(str); cntZ=cntO=cntJ=0; ... 阅读全文
posted @ 2012-04-13 22:31 LegendaryAC 阅读(228) 评论(0) 推荐(0)
HDU 3782 xxx定律
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3782View Code #include <stdio.h>#include <stdlib.h>int main(){ int n; while(scanf("%d",&n),n) { int cnt=0; while(1) { if(n==1)break; if(n&1) n=(3*n+1)>>1; else n>>=1... 阅读全文
posted @ 2012-04-13 22:07 LegendaryAC 阅读(165) 评论(0) 推荐(0)
HDU 3785 寻找大富翁
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3785View Code #include <stdio.h>#include <stdlib.h>#define INF 200000000int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int a[110000];int main(){ int n,m; while(scanf("%d%d",&n,&m),(n||m)) { for(int i=0;i<100001 阅读全文
posted @ 2012-04-13 22:02 LegendaryAC 阅读(225) 评论(0) 推荐(0)
HDU 2399 GPA
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2399最短路最小生成树神马的几道题纠结了几个小时,换换心情吧。直接按题目要求做。View Code #include <stdio.h>#include <string.h>int main(){ char str[300]; int len,i; int s,f,cnt; while(gets(str)) { len=strlen(str); s=f=cnt=0; for(i=0;i<len;i++) { ... 阅读全文
posted @ 2012-04-13 13:49 LegendaryAC 阅读(402) 评论(0) 推荐(0)
HDU 1879 继续畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1879最小生成树。。。m,n又看反了。。。无语ingView Code #include #include #include int idx[1000000];struct node{ int a,b,cos... 阅读全文
posted @ 2012-04-13 13:09 LegendaryAC 阅读(145) 评论(0) 推荐(0)
HDU 1863 畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1863裸的最小生成树,只需多判断一下是否连通,我用的方法是看是否只有一个根节点。ps:m和n写反了,害我查了1h啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊View Code #include #include #include... 阅读全文
posted @ 2012-04-13 10:12 LegendaryAC 阅读(208) 评论(0) 推荐(0)
HDU 1233 还是畅通工程
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1233最小生成树,查找根节点的函数里面等号写成赋值号,查了半个小时、、、View Code #include #include #define N 110int idx[N];struct node{ int... 阅读全文
posted @ 2012-04-13 09:06 LegendaryAC 阅读(145) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 12 13 下一页