1968: [Ahoi2005]COMMON 約數研究
阿新 • • 發佈:2018-02-04
led gre pos ems () bmi eve memory style
Submit: 3354 Solved: 2289
[Submit][Status][Discuss]
1968: [Ahoi2005]COMMON 約數研究
Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 3354 Solved: 2289
[Submit][Status][Discuss]
Description
Input
只有一行一個整數 N(0 < N < 1000000)。Output
只有一行輸出,為整數M,即f(1)到f(N)的累加和。Sample Input
3Sample Output
5code
換個角度去思考
1 #include<cstdio> 2View Code3 int main () { 4 int n; 5 scanf("%d",&n); 6 long long ans = 0; 7 for (int i=1; i<=n; ++i) { 8 ans += (n / i); 9 } 10 printf("%lld",ans); 11 return 0; 12 }
1968: [Ahoi2005]COMMON 約數研究