감 ¶
계 고 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;
}










