andre_joy

导航

2012年7月3日

hdu 1197

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1197题意:求一个数转换成10,12,16进制后各个位上的数的和是否相等。mark:模拟进制转换。代码:#include <stdio.h>int zh(int a, int n){ int sum = 0; while(a) { sum += a%n; a /= n; } return sum;}int main(){ int m; for(m = 2992; m < 10000; m++) if(zh(m, 10) ... 阅读全文

posted @ 2012-07-03 23:34 andre_joy 阅读(113) 评论(0) 推荐(0) 编辑

hdu 1194

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1194题意:赌球,用比分的和与比分的差的绝对值赌博。mark:注意比分都是整数。代码:#include <stdio.h>int main(){ int t,m,n; scanf("%d", &t); while(t-- && scanf("%d%d", &m, &n)) if(m < n || (m+n) & 1) puts("impossible"); else printf 阅读全文

posted @ 2012-07-03 23:21 andre_joy 阅读(101) 评论(0) 推荐(0) 编辑

hdu 1143

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1143题意:3*n的矩形用2*1的砖堆法。mark:wa了,两次。。一次数组只开到30了,一次循环跳出条件写错了。。囧……递推就ok了。 我是画图一步一步推出来的。首先肯定是2个2个增加的。首先考虑不交叉的f(n) = 3*f(n-2),再考虑交叉的,会发现规律,2*(f(n-4)+f(n-6)+……) ps:后来看大牛的代码,发现公式化简了可以降低复杂度,虽然这题n最大才30。f(n) = 4*f(n-2)-f(n-4)代码:#include <stdio.h>int main(){ .. 阅读全文

posted @ 2012-07-03 22:21 andre_joy 阅读(97) 评论(0) 推荐(0) 编辑

hdu 1098

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1098题意:给定k,求满足任何x都能使f(x)能被65整除的a的值。mark:本题要用欧拉定理,一开始完全不会啊。。。欧拉定理证明http://baike.baidu.com/view/48903.htm 从65着手。65=13*5,所以要f(x)被65整除,那么f(x)一定整除13和5。 先考虑13。f(x)=13*x^5 + 5*x^13 + k*a*x,13*x^5显然是13的倍数。所以只用考虑5*x^13+k*a*x = x*(5*x^12+k*a)。 1.当x能被13整除的时候... 阅读全文

posted @ 2012-07-03 21:38 andre_joy 阅读(74) 评论(0) 推荐(0) 编辑

hdu 1039

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1039题意:判断密码是否可行。满足三个条件:1.至少一个元音字母。2.连续三个字母不能同时为元音或辅音。3.连续两个字母不能相同,但是不包括"ee"和"oo"。mark:无。代码:#include <stdio.h>#include <string.h>int yy(char a){ if(a == 'a' || a == 'e' || a == 'i' || a == 'o' 阅读全文

posted @ 2012-07-03 18:41 andre_joy 阅读(302) 评论(0) 推荐(0) 编辑

hdu 1037

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1037题意:货物的高度能否通过给定高度的障碍物。mark:无代码:#include <stdio.h>int main(){ int a[3],i; while(~scanf("%d%d%d", a, a+1, a+2)) { for(i = 0; i < 3; i++) if(a[i] <= 168) break; if(i == 3) puts("NO CRASH"); else printf("CRASH %d\n" 阅读全文

posted @ 2012-07-03 18:06 andre_joy 阅读(119) 评论(0) 推荐(0) 编辑

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 阅读(93) 评论(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 阅读(95) 评论(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 阅读(64) 评论(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 阅读(75) 评论(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 阅读(239) 评论(0) 推荐(0) 编辑