目录:
题目:
题意:
给出一个数,求ta的所有约数的和
分析:
100%数据<=1,000,000..直接暴力枚举,不多说
AC后感想:
没少好说的了,看代码吧
代码:
//太水了,不解释了
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#define LL long long
using namespace std;
inline LL read() {
LL d=0,f=1;char s=getchar();
while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
while(s>='0'&&s<='9'){d=d*10+s-'0';s=getchar();}
return d*f;
}
int main()
{
int n=read();
LL ans=0;
for(int i=1;i<=n;i++) if(n%i==0) ans+=i;
printf("%lld",ans);
fclose(stdin);
fclose(stdout);
}