== 소감 == 쉬운줄 알았는데 계속 틀린답나옴 일단 한숨자고 나서 보니 숫자 범위가 4294967295까지임 int형을 unsigned로 바꾼후 통과 == 소스 == {{{~cpp #include using namespace std; // 숫자를 뒤집는다. unsigned reverse(unsigned p) { unsigned t = 0; while (p != 0) { t = t * 10 + p % 10; p = (int)(p / 10); } return t; } int main() { int n; cin >> n; int testCase; for (testCase = 0; testCase < n; testCase++) { unsigned int p; // 입력받은 숫자 unsigned int re; // 뒤집은 숫자 int iter = 0; // 반복해서 더한 횟수 cin >> p; while (true) { re = reverse(p); if (p == re) break; else { p = p + re; } iter++; } cout << iter << " " << p << endl; } return 0; } }}} == 댓글 ==