当前位置:网站首页>[Luogu p1403] Research on divisor

[Luogu p1403] Research on divisor

2022-06-13 09:35:00 Ayane.

 Insert picture description here
l i n k link link

analysis :

For each number k   ( 1 < = k < = n ) k~(1<=k<=n) k (1<=k<=n) n n n The sum of the divisors of, i.e k k k The sum of all multiples of

CODE:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
int n,ans;
int main(){
    
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		ans+=n/i;
	printf("%d",ans);
	return 0;
}
原网站

版权声明
本文为[Ayane.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270530323752.html