#96-【水水水】约数研究

版权声明:反正也没有人会转,下一个 https://blog.csdn.net/drtlstf/article/details/82719351

东 方 发 白,仍 在 机 房 里 待。

方 法 竟 想 不 出 来。

永 远 爆 零,骗 分 不 成。

夜 以 继 日,头 破 血 流。

抄 题 解 去 吧!

Description

Input

只有一行一个整数 N(0 < N < 1000000)。

Output

只有一行输出,为整数M,即f(1)到f(N)的累加和。

Sample Input

3

Sample Output

5

其实很水,只是考试的时候没想出来(qaq)

自古蛾子套路多,可与____争霸王

#include <iostream>

using namespace std;

int main(void)
{
	int n, i, res = 0;
	
	scanf("%d", &n);
	
	for (i = 1; i <= n; ++i)
	{
		res += n / i;
	}
	
	printf("%d", res);
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/drtlstf/article/details/82719351
今日推荐