약수의 합을 구하면 되는 간단한 문제이다.
#include <string> #include <vector> using namespace std; int solution(int n) { int answer = n; for (int i=1; i<n; i++) if (n%i == 0) answer += i; return answer; }