分析:不断取余,满足条件的就加上
Code:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
int n;
while(~scanf("%d", &n)) {
int sum = 0;
for(int i = 1; i <= n; i++)
if(n%i == 0) sum += i;
printf("%d\n", sum);
}
return 0;
}