1968: [Ahoi2005]COMMON 约数研究
生活随笔
收集整理的這篇文章主要介紹了
1968: [Ahoi2005]COMMON 约数研究
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1968: [Ahoi2005]COMMON 約數(shù)研究
Time Limit:?1 Sec??Memory Limit:?64 MBSubmit:?3354??Solved:?2289
[Submit][Status][Discuss]
Description
Input
只有一行一個(gè)整數(shù) N(0 < N < 1000000)。Output
只有一行輸出,為整數(shù)M,即f(1)到f(N)的累加和。Sample Input
3Sample Output
5code
換個(gè)角度去思考
1 #include<cstdio> 2 3 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 } View Code?
轉(zhuǎn)載于:https://www.cnblogs.com/mjtcn/p/8413492.html
總結(jié)
以上是生活随笔為你收集整理的1968: [Ahoi2005]COMMON 约数研究的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: u盘有病毒 exe文件怎么恢复 恢复U盘
- 下一篇: 宏基笔记本电脑怎么改bois 宏基笔记本