andre_joy

导航

随笔分类 -  HDOJ

上一页 1 2 3 4 5 6 下一页

hdu 2368
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2368题意:判断一个正方形的pizza能否放在一个圆形的桌子上,使得pizza没有地方不接触桌子。mark:正方形对角线/2跟圆半径比较。代码:#include <stdio.h>#include <math.h>int main(){ int r,w,l,i; double d; i = 1; while(scanf("%d", &r), r) { scanf("%d%d", &w, &l); d = sqrt(w 阅读全文

posted @ 2012-07-03 17:56 andre_joy 阅读(99) 评论(0) 推荐(0)

hdu 2147
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2147题意:从右上角开始出发,可以向左,坐下,下三个方向走一步,求谁最后没路可走。mark:wa了一次,把问题想简单了(一开始以为只用判断是不是三的倍数。) 简单博弈。思路可以是递推,a(i,j)代表kiki在第i行第j列的时候的胜负。则a(i,j) = !a(i-1,j) || !a(i,j-1) || !a(i-1,j-1).代码:#include <stdio.h>int main(){ int m,n; while(scanf("%d%d", &n, &a 阅读全文

posted @ 2012-07-03 17:46 andre_joy 阅读(104) 评论(0) 推荐(0)

hdu 2212
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2212题意:中文……mark:打表,只有四个数。。。代码:#include <stdio.h>int main(){ printf("1\n2\n145\n40585\n"); return 0;} 阅读全文

posted @ 2012-07-03 17:18 andre_joy 阅读(71) 评论(0) 推荐(0)

hdu 1407
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1407题意:中文……mark:懒得写一些判断了,直接循环了。代码:#include <stdio.h>int main(){ int n,i,j,k,f; while(~scanf("%d", &n)) { f = 0; for(i = 1; i < 100; i++) { for(j = i; j < 100; j++) { for(k = j; k < 100; k+... 阅读全文

posted @ 2012-07-03 01:20 andre_joy 阅读(81) 评论(0) 推荐(0)

hdu 1337
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1337题意:狱警玩游戏,第一次转换1,2,……,n的锁的开关状态,第二次转换2,4,……,第三次3,6,……依次类推到第n次。求最后有多少锁是开着的。mark:模拟就ok了。代码:#include <stdio.h>#include <string.h>int main(){ int t,n,a[110]; int i,j,sum; scanf("%d", &t); while(t-- && scanf("%d", 阅读全文

posted @ 2012-07-03 01:05 andre_joy 阅读(246) 评论(0) 推荐(0)

hdu 1412
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1412题意:中文……mark:先排序,再一起扫描一遍。代码:#include <stdio.h>#include <stdlib.h>int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b;}int a[10010],b[10010],c[20010];int main(){ int n,m; int i,j,k; while(~scanf("%d%d", &n, & 阅读全文

posted @ 2012-07-01 21:15 andre_joy 阅读(140) 评论(0) 推荐(0)

hdu 1017
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1017题意:给定n,m,求满足(a^2+b^2+m)/(a*b)仍是整数的(a,b)的组数。mark:n的值比较小,扫描一遍,也就100*100.代码:#include <stdio.h>int main(){ int t,n,m,sum; int i,j,a,b; scanf("%d", &t); for(i = 0; i < t; i++) { if(i) puts(""); j = 1; while(~scanf("%d% 阅读全文

posted @ 2012-07-01 19:43 andre_joy 阅读(181) 评论(0) 推荐(0)

hdu 1249
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1249题意:中文……mark:此题重在理解推导公式,f(n)=f(n-1)+6*(n-1),化简为:f(n)=3*n*(n-1)+2。 一个三角形的时候,再加一个三角形,每一条变会与第一个三角形的两条边相交,这样增加2个小三角形,即两个面。f(2)=3*2+f(1),再加一个三角形,每一条边会与前两个三角形的四条边相交,形成四个小三角形,f(3)=3*4+f(2),依次类推,即f(n)=3*2*(n-1)+f(n-1)。代码:#include <stdio.h>int main(){ int 阅读全文

posted @ 2012-07-01 18:04 andre_joy 阅读(241) 评论(0) 推荐(0)

hdu 1014
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1014题意:通过题目给出的递推公式能否得到0-mod-1之间的所有数。mark:wa了一次,把问题想简单了,一位只是一个数能被另一个数整除……其实是判断两个数是否互素。代码:#include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b;}int main(){ int m,n; while(~scanf("%d%d", &m, &n)) { printf("%10d%10d &qu 阅读全文

posted @ 2012-07-01 17:25 andre_joy 阅读(85) 评论(0) 推荐(0)

hdu 1070
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1070题意:主角要买牛奶,对牛奶的要求是生产日期5天内引用,每天喝200ml,少于200ml的扔掉,商场牛奶均是当天生产。 选取满足要求的单价最小的牛奶,当单价一样,选择容量多的。mark:wa了两次,都是精度问题,在整数问题里面最好不要用浮点数运算。(一般都是除法比较。)代码:#include <stdio.h>#include <string.h>int main(){ char m[100],d[100]; int t,n,a,b,c,aa,bb,cc; scanf(&qu 阅读全文

posted @ 2012-07-01 15:38 andre_joy 阅读(421) 评论(0) 推荐(0)

hdu 2200
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2200题意:中文……mark:直接公式化简可得(2^(n-1))*(n-2)+1,要是不会化简,可以用递推做f(n)=2*f(n-1)+2^(n-1)-1代码:#include<stdio.h>int main(){ long long n; while (~scanf ("%I64d", &n)) printf ("%I64d\n", (1LL << (n-1)) * (n-2) + 1); return 0;} 阅读全文

posted @ 2012-07-01 15:01 andre_joy 阅读(74) 评论(0) 推荐(0)

hdu 1228
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1228题意:中文……mark:仔细。。代码:#include <stdio.h>#include <string.h>int tr(char a[]){ if(!strcmp(a, "zero")) return 0; if(!strcmp(a, "one")) return 1; if(!strcmp(a, "two")) return 2; if(!strcmp(a, "three")) retu 阅读全文

posted @ 2012-07-01 14:27 andre_joy 阅读(224) 评论(0) 推荐(0)

hdu 1425
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1425题意:中文……mark:qsor()简单水过。不过效率不是很高,985ms,可以用别的排序方法加快效率。代码:#include <stdio.h>#include <stdlib.h>int cmp(const void *a, const void *b){ return *(int *)b - *(int *)a;}int a[1000010];int main(){ int m,n,i; while(~scanf("%d%d", &n, & 阅读全文

posted @ 2012-07-01 14:04 andre_joy 阅读(279) 评论(0) 推荐(0)

hdu 2526
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2526题意:中文……下一行字符根据上一行对应三个字符来决定。mark:无。代码:#include <stdio.h>#include <string.h>char a[2][510],b[8][4];int f[8];int tr(char c[]){ int i; for(i = 0; i < 8; i++) if(!strcmp(c, b[i])) return f[i];}int main(){ char c[4]; int t,m,le; int i,... 阅读全文

posted @ 2012-07-01 13:57 andre_joy 阅读(170) 评论(0) 推荐(0)

hdu 1408
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1408题意:中文……mark:wa了一次。。主要是精度问题,要判断好究竟滴多少次。代码:#include <stdio.h>int main(){ double v,d; int i,sum,m; while(~scanf("%lf%lf", &v, &d)) { sum = 0; if((int(v/d))*10 == (int)(v/d*10)) m = (int)(v/d); else m = (int)(v/d) + 1; ... 阅读全文

posted @ 2012-07-01 01:19 andre_joy 阅读(81) 评论(0) 推荐(0)

hdu 2522
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2522题意:中文……mark:真是2死了,wa了5次。开始是因为数组开小了,因为余数是在n*10的范围内的,所以数组要开10^6。后来是因为给a[]初始化的时候,n应该先转换成正数,结果一直wa。。。此题是模仿除法运算,每一步输出一个结果。代码:#include <stdio.h>int a[1000010];int main(){ int t,n,m; scanf("%d", &t); while(t-- && scanf("%d&qu 阅读全文

posted @ 2012-07-01 00:46 andre_joy 阅读(152) 评论(0) 推荐(0)

hdu 2523
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2523题意:中文……mark:数据范围只是0-2000,直接桶排序,然后简单搜索。代码:#include <stdio.h>#include <string.h>int fab(int a) {return a < 0 ? -1*a : a;}int a[1010],b[2010];int main(){ int c,n,k; int i,j,f; scanf("%d", &c); while(c-- && scanf(" 阅读全文

posted @ 2012-06-30 23:28 andre_joy 阅读(115) 评论(0) 推荐(0)

hdu 2521
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=2521题意:中文……mark:数据较少,直接暴力破解,0ms。代码:#include <stdio.h>int m[5010];int main(){ int t,a,b,max; for(a = 2; a < 5001; a++) for(b = a; b < 5001; b += a) m[b]++; scanf("%d", &t); while(t-- && scanf("%d%d", &a, & 阅读全文

posted @ 2012-06-30 23:14 andre_joy 阅读(83) 评论(0) 推荐(0)

hdu 1850
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1850题意:中文……mark:wa了一次,一开始直接用n!公式了。。10!就是100w了!用杨辉三角做~代码:#include <stdio.h>int main(){ int t,a,b,m[30][31]={1,1}; for(a = 1; a < 30; a++) { m[a][0] = 1; for(b = 1; b < a+1; b++) m[a][b] = m[a-1][b-1] + m[a-1][b]; m[... 阅读全文

posted @ 2012-06-30 20:51 andre_joy 阅读(91) 评论(0) 推荐(0)

hdu 1701
摘要:地址:http://acm.hdu.edu.cn/showproblem.php?pid=1701题意:求两个百分数对应的人数不想等的最小总人数。(纯属扯淡的题目。。。)mark:简单搜索。代码:#include <stdio.h>int main(){ int n,i; double a,b; scanf("%d", &n); while(n-- && scanf("%lf%lf", &a, &b)) { for(i = 2; i < 10000; i++) if((int)(i*a/100.0 阅读全文

posted @ 2012-06-30 20:20 andre_joy 阅读(85) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 下一页