감 ¶
는데 린답나 단 고 나 보 범가 4294967295까
int unsigned로 바꾼 과
int unsigned로 바꾼 과
¶
~cpp
#include <iostream>
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;
}










