摘要:
2011-12-14 05:37:29地址:http://acm.hdu.edu.cn/showproblem.php?pid=2035题意:中文。。。还用不上快速幂。代码:# include <stdio.h>int main (){ int n, m, mul ; while (~scanf ("%d%d", &n, &m) && (m||n)) { mul = 1 ; while (m--) mul = (mul * n) % 1000 ; printf ("%d\n", mul) ; } return 阅读全文
摘要:
2011-12-14 05:42:17地址:http://acm.hdu.edu.cn/showproblem.php?pid=2041题意:中文递推。mark:dp[i] = dp[i-1] + dp[i-2]。用了long long,最大才102334155,int应该也可。代码:# include <stdio.h>long long dp[50] = {0, 1, 1} ;int main (){ int i, n ; for (i = 3 ; i <= 40 ; i++) dp[i] = dp[i-1]+dp[i-2] ; scanf ("%d" 阅读全文
摘要:
2011-12-14 05:33:58地址:http://acm.hdu.edu.cn/showproblem.php?pid=2097题意:中文,进制转换。代码:# include <stdio.h>int base(int n, int b){ int sum = 0 ; while (n) { sum += n%b ; n /= b ; } return sum ;}int main (){ int n ; while (~scanf ("%d", &n) && n) { if (base(n,10... 阅读全文
摘要:
2011-12-14 05:30:17地址:http://acm.hdu.edu.cn/showproblem.php?pid=2096题意:中文。。。代码:# include <stdio.h>int main (){ int n, m ; scanf ("%d", &n) ; while (~scanf ("%d%d", &n, &m)) printf ("%d\n", (n%100 + m%100) % 100) ; return 0 ;} 阅读全文
摘要:
2011-12-14 05:27:59地址:http://acm.hdu.edu.cn/showproblem.php?pid=2071题意:输出n个数里最大的数字。代码:# include <stdio.h>int main (){ int T, n ; double max, high ; scanf ("%d", &T) ; while (T--) { scanf ("%d", &n) ; max = -1 ; while (n--) { scanf ("%lf", &high) ... 阅读全文
摘要:
2011-12-14 05:25:11地址:http://acm.hdu.edu.cn/showproblem.php?pid=2075题意:中文,屌爆了,hdu还有那么简单的题。代码:# include <stdio.h>int main (){ int n, m ; scanf ("%d", &n) ; while (~scanf ("%d%d", &n, &m)) puts (n%m?"NO":"YES") ; return 0 ;} 阅读全文
摘要:
2011-12-14 05:23:09地址:http://acm.hdu.edu.cn/showproblem.php?pid=1108题意:中文,lcm = a*b/gcd。其中lcm是最小公倍数,gcd是最大公约数,欧几里得算法。代码:# include <stdio.h>int gcd(int n,int m){return n%m==0?m:gcd(m,n%m);}int main (){ int n, m ; while (~scanf ("%d%d", &n, &m)) printf ("%d\n", n*m/gc 阅读全文
摘要:
2011-12-14 05:20:24地址:http://acm.hdu.edu.cn/showproblem.php?pid=2524题意:中文。mark:有意思。2个维度分开考虑,结果相乘,用到求和公式,没超过int范围。代码:# include <stdio.h>int main (){ int n, m ; scanf ("%d", &n) ; while (~scanf ("%d%d", &n, &m)) printf ("%d\n", n*(n+1)*m*(m+1)/4) ; retur 阅读全文
摘要:
2011-12-14 05:16:49地址:http://acm.hdu.edu.cn/showproblem.php?pid=1096题意:多组,输入n个数字,输出和。代码:# include <stdio.h>int main (){ int sum, n, num ; int flag = 0 ; scanf ("%d", &n) ; while (~scanf ("%d", &n)) { sum = 0 ; while (n--){ scanf ("%d", &num) ; sum +... 阅读全文
摘要:
2011-12-14 05:09:52地址:http://acm.hdu.edu.cn/showproblem.php?pid=2011题意:中文。。。代码:# include <stdio.h>int main (){ int T, n ; double sum ; scanf ("%d", &T) ; while (T--) { scanf ("%d", &n) ; sum = 0 ; while (n--) { sum += 1.0 / (n&1 ? n+1 : -1-n) ; ... 阅读全文