1968: [Ahoi2005]COMMON 约数研究
Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 1412 Solved: 1072
[ Submit][ Status][ Discuss]
Description
Input
只有一行一个整数 N(0 < N < 1000000)。
Output
只有一行输出,为整数M,即f(1)到f(N)的累加和。
Sample Input
3
Sample Output
5
HINT
Source
也不能算是简单,虽然代码很简单,只有胆大心细,机智勇敢智慧与外貌并存,机警又不缺乏果断的阳光青年,才能顺利拿下一A走向人生巅峰:
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
long long m,n,i,j,k,l,ans;
int main()
{
while(scanf("%lld",&m)!=EOF)
{
ans=0;
for(i=1;i<=m;i++)
ans+=m/i;
printf("%lld\n",ans);
}
}