#include <string> #include <vector> using namespace std; int find(int n) { int answer = n; for(int i = 1; i <= n/2; i++) { if(n % i == 0) { answer += i; } } return answer; } int solution(int n) { int answer = find(n); return answer; } | cs |
'Programmers > Level 1' 카테고리의 다른 글
[프로그래머스 1] 자릿수 더하기 (C/C++) (0) | 2019.10.18 |
---|---|
[프로그래머스 1] 이상한 문자 만들기 (C/C++) (0) | 2019.10.18 |
[프로그래머스 1] 시저 암호 (C/C++) (0) | 2019.10.18 |
[프로그래머스 1] 문자열을 정수로 바꾸기 (C/C++) (0) | 2019.10.17 |
[프로그래머스 1] 수박수박수박수박수박수? (C/C++) (0) | 2019.10.17 |