![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 #include <cstdio> 2 3 int n,ans; 4 5 int main(){ 6 scanf("%d",&n); 7 for (int i=1;i<=n;i++) ans+=n/i; 8 printf("%d\n",ans); 9 return 0; 10 }
1 #include <cstdio> 2 3 int n,ans; 4 5 int main(){ 6 scanf("%d",&n); 7 for (int i=1;i<=n;i++) ans+=n/i; 8 printf("%d\n",ans); 9 return 0; 10 }
转载于:https://www.cnblogs.com/registerzxr/p/5081893.html