mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-27 14:36:19 +00:00
23 lines
344 B
C
23 lines
344 B
C
|
#include <math.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
int main() {
|
||
|
long long n, ans = 0;
|
||
|
|
||
|
scanf("%lld", &n);
|
||
|
|
||
|
for (long long i = 1; i <= (long long)sqrt(n); i++) {
|
||
|
if (n % i == 0) {
|
||
|
ans += i;
|
||
|
|
||
|
if (i != n / i) {
|
||
|
ans += n / i;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("%lld\n", ans);
|
||
|
|
||
|
return 0;
|
||
|
}
|