上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 51 下一页
摘要: 2011-12-16 13:29:06地址:http://acm.hdu.edu.cn/showproblem.php?pid=1248题意:中文,不解释。mark:首先,mod50后多出来的部分肯定是要浪费的。然后50的倍数部分,只有n < 150和n == 250才会无法付清,其余的都可以不浪费超过50。代码:# include <stdio.h>int main (){ int n, sum ; scanf ("%d", &n) ; while (~scanf ("%d", &n)) { sum = n%50 ; 阅读全文
posted @ 2012-01-06 17:40 Seraph2012 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 13:59:48地址:http://acm.hdu.edu.cn/showproblem.php?pid=1282题意:中文,不解释。代码:# include <stdio.h>int reverse(int n){ int ans = 0 ; while (n) { ans = ans * 10 + n%10 ; n /= 10 ; } return ans ;}int calc(int n){ int cnt = 0 ; while(n!=reverse(n)) { n = n+... 阅读全文
posted @ 2012-01-06 17:40 Seraph2012 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 13:12:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=1222题意:有n个洞围成1圈,标号为0-n-1。狼从0开始搜索洞,下一次搜索是从上一次往后数m个。给n和m,问是否有安全洞,狼是搜不到的。mark:其实就是问gcd(m,n) 是否不为1。代码:# include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b;}int main (){ int T, n, m ; scanf ("%d", &T) ; while 阅读全文
posted @ 2012-01-06 17:39 Seraph2012 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 13:17:13地址:http://acm.hdu.edu.cn/showproblem.php?pid=2104题意:丢手绢,其实和1222一样。代码:# include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b;}int main (){ int n, m ; while (~scanf ("%d%d", &n, &m)) { if (n==-1&&m==-1) break ; puts (gcd(n,m) == 1 ? "YE 阅读全文
posted @ 2012-01-06 17:39 Seraph2012 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 12:50:14地址:http://acm.hdu.edu.cn/showproblem.php?pid=2153题意:中文,模拟。。。代码:# include <stdio.h># include <String.h>int dp[15][15] ;void gao(int n){ int i, tab[4][2] = {0, 1, 1, 0, 0 , -1, -1, 0} ; int d = 0, x, y ; memset (dp, 0, sizeof(dp)) ; dp[1][1] = 1 ; x = 1, y = 2 ; fo... 阅读全文
posted @ 2012-01-06 17:38 Seraph2012 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 13:07:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=1200题意:把一串字符竖着写成n列,得到一张表。现在横着把表的每行拼成一个字符串,其中奇数行(从0开始)反着拼。给你这个字符串求原来的加密前的字符串。代码:# include <stdio.h>char str[210] ;char dp[110][20] ;int main (){ int i, j, cnt ; int n, d, x, y ; while (~scanf ("%d%*c", &n) && 阅读全文
posted @ 2012-01-06 17:38 Seraph2012 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 12:34:22地址:http://acm.hdu.edu.cn/showproblem.php?pid=1266题意:把数字反过来输出,如果末尾有0,保持在末尾。代码:# include <stdio.h># include <math.h>void reverse(int n){ if (n == 0) return ; printf ("%d", n%10) ; reverse(n/10) ;}void output(int n){ int zero = 0 ; if (n == 0){ puts ("0&quo 阅读全文
posted @ 2012-01-06 17:37 Seraph2012 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 12:20:57地址:http://acm.hdu.edu.cn/showproblem.php?pid=1128题意:d(n)被定义为n各位数码和+n。输出[1,1000000]内不存在i使得d(i)==n的所有n。mark:直接搜,开个100w的数组。代码:# include <stdio.h>int dp[1000010] ;int d(int n){ int sum = 0, nn = n ; while (nn) { sum += nn%10 ; nn /= 10 ; } return n + sum ;... 阅读全文
posted @ 2012-01-06 17:36 Seraph2012 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 12:27:38地址:http://acm.hdu.edu.cn/showproblem.php?pid=2080题意:中文,水。代码:# include <stdio.h># include <math.h>int main (){ int T ; double x1,y1,x2,y2,s1,s2,a1,a2, a ; scanf ("%d", &T) ; while (T--) { scanf ("%lf%lf%lf%lf", &x1, &y1, &x2, &y2) 阅读全文
posted @ 2012-01-06 17:36 Seraph2012 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 12:01:00地址:http://acm.hdu.edu.cn/showproblem.php?pid=2105题意:给3个点的坐标代表一个三角形,求三角形的重心(三条中线的交点)。mark:计算几何果断在mathematica的帮助下很给力!代码:# include <stdio.h>typedef struct POINT{ double x, y ;}POINT ;typedef struct LINE{ double a, b, c ; //ax+by+c == 0}LINE ;POINT tri[3] ;POINT Middle(POINT p1, 阅读全文
posted @ 2012-01-06 17:35 Seraph2012 阅读(202) 评论(0) 推荐(1) 编辑
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 51 下一页