解题思路:
注意事项:
参考代码:
#include<stdio.h>
int f(int n);
int fx(int n);
int main()
{
int M,L,count;
scanf("%d",&L);
while(L--)
{
count=0;
scanf("%d",&M);
while(!f(M)&&count<=8)
{
M+=fx(M);
count++;
}
if(count<=8) printf("%d\n",count);
else printf("%d\n",0);
}
return 0;
}
int f(int n)
{
int tem,a=0;
tem=n;
while(tem/10!=0)
{
a=10*a+tem%10;
tem/=10;
}
a=10*a+tem;
if(a==n) return 1;
else return 0;
}
int fx(int n)
{
int tem,a=0;
tem=n;
while(tem/10!=0)
{
a=10*a+tem%10;
tem/=10;
}
a=10*a+tem;
return a;
}
0.0分
0 人评分
Tom数 (C++代码)浏览:825 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:500 |
C语言训练-素数问题 (C语言代码)浏览:1654 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:411 |
wu-淘淘的名单 (C++代码)浏览:1331 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:647 |
Cylinder (C语言描述+详细分析)浏览:3262 |
文科生的悲哀 (C语言代码)浏览:1398 |
星期判断机 (C语言代码)浏览:859 |
DNA (C语言代码)浏览:745 |