그냥 정석대로 반복문으로 풀었다.

using namespace std;

int solution(int n) {
    for (int i = 2; i < n; i++)
        if (n % i == 1)
            return i;
}

+ Recent posts