#include <stdio.h> int main() { int n,num,renum,sum,resum,i,t,count; scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%d",&num); count=1; while (count<=8) { t=num; resum=renum=0; while (t) { renum*=10; renum+=t%10; t/=10; } sum=num+renum; t=sum; while (t) { resum*=10; resum+=t%10; t/=10; } if (sum==resum) break; num=sum; count++; } if (count==9) printf("0\n"); else printf("%d\n",count); } return 0; }
解题思路:
注意事项:
参考代码:
0.0分
3 人评分