2012年4月5日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1215求N因子的和,从1找到sqrt(n),成对的找,后面的用前面的除View Code #include <stdio.h>#include <string.h>#include <math.h>#include <stdlib.h>int gao(int n){ int s=0,i,cc; cc=sqrt(n); for(i=1;i<=cc;i++) if(n%i==0&&n/i>cc&&n/i!=n) s+=(i 阅读全文
posted @ 2012-04-05 23:04 LegendaryAC 阅读(236) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1282两种想法,用字符串处理或是用数字处理,这里数字处理更简单View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int IsHw(int n){ int p,ans=0; p=n; while(n) { ans=ans*10+n%10; n/=10; } if(ans==p)return 1; return 0;}int Nx... 阅读全文
posted @ 2012-04-05 19:23 LegendaryAC 阅读(227) 评论(0) 推荐(0) 编辑
 
摘要: http://poj.org/problem?id=1004求12个数的平均数、、、太无耻了View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { double s,a[13]; int i; while(~scanf("%lf",&a[0])) { s=a[0]; for(i=1;i<12;i++) { scanf("%lf",a+i); s+=a[... 阅读全文
posted @ 2012-04-05 12:16 LegendaryAC 阅读(123) 评论(0) 推荐(0) 编辑
 
摘要: http://poj.org/problem?id=2027判断a<b......脸皮这两天又厚了不少、、、这种题也拿来充数、、、忏悔ingView Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { int t; int a,b; scanf("%d",&t); while(t--) { scanf("%d%d",&a,&b); if(a<b 阅读全文
posted @ 2012-04-05 12:11 LegendaryAC 阅读(295) 评论(0) 推荐(0) 编辑
 
摘要: http://poj.org/problem?id=2017按题意计算路程,直接算View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { int n,i; int s[20],t[20]; int ans; while(scanf("%d",&n),n!=-1) { for(i=0;i<n;i++) scanf("%d%d",s+i,t+i); ans=s[0 阅读全文
posted @ 2012-04-05 12:01 LegendaryAC 阅读(172) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=26012932MS......好险注意:(1)n的数据范围(2)j>=i(3)开方拿出来算因为上面三点挂了几次,勉强过关View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { __int64 n; int t,i,p; int cnt; scanf("%d",&t); while(t--) { 阅读全文
posted @ 2012-04-05 11:43 LegendaryAC 阅读(251) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4143两个for枚举肯定超时,移项因式分解后,只要一个for枚举(y-x)就好了,(y+x)用n去除(y-x)。另外两个小点,关注到(y-x)一定小于等于sqrt(n),并且(y-x)与(y+x)不相等View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>int main() { int t,n; int i; int f; scanf("% 阅读全文
posted @ 2012-04-05 11:18 LegendaryAC 阅读(250) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.bjtu.edu.cn/problem/detail?pid=1621(1)总矩形数:考虑1行n个,由一个、两个、三个......1*1正方形组成的方法数为n、n-1、n-2......1,和为(n+1)*n/2(2)正方形数:n*m的矩形,不妨设n<m,则最大的矩形为n*n,这样的矩形根据乘法原理有1*(m-n+1)个,依次考虑(n-1)*(n-1)......1*1的矩形,方法数同理可得另附HDU 2524 矩形A+B,与此题一个思路,不过只考虑(1)罢了http://acm.hdu.edu.cn/showproblem.php?pid=2524View Cod 阅读全文
posted @ 2012-04-05 11:11 LegendaryAC 阅读(199) 评论(0) 推荐(0) 编辑