标签:accept sample pid ted 编号 -- bottom code blog
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1215
题目类型:
暴力模拟
题意概括:
求一个整数的所有因子和。
解题思路:
暴力找出所有因子求和
题目:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 46191 Accepted Submission(s): 14721
# include <stdio.h> int main () { int n,t,i,sum; scanf("%d",&t); while(t--) { scanf("%d",&n); sum=0; for(i=1;i*i<=n;i++) { if(n%i==0) { sum+=i; if(i!=1 && n!=i*i) { sum+=n/i; } } } printf("%d\n",sum); } return 0; }
标签:accept sample pid ted 编号 -- bottom code blog
原文地址:http://www.cnblogs.com/love-sherry/p/6942319.html