解题思路:
注意事项:
参考代码:
#include <stdio.h>
#include <math.h>
int main(void)
{
int i, j, l, k, m, x, y, z, h, gaowei, diwei, sum, count, count1;
int num[10];
scanf("%d", &l);
for (i = 1;i <= l;i++)
{
count = 0;
scanf("%d", &m);
while (count <= 8)
{
count1 = 0;
sum = 0;
x = m;
j = 0;
while (x != 0)
{
num[j] = x % 10;
x = x / 10;
j++;
}
z = 0;
while (j != 0)
{
sum = sum + pow(10, z)*num[j - 1];
z++;
j--;
}
m = m + sum;
x = m;
count++;
y = 0;
while (x != 0)
{
x = x / 10;
y++;
}
x = m;
for (k = 1, h = y - k;k <= y / 2;k++)
{
gaowei = x / pow(10, h);
diwei = x % 10;
x = x - gaowei*pow(10, h);
x = x / 10;
h = h - 2;
if (gaowei == diwei)
count1++;
else
{
count1 = 0;
break;
}
}
if (count1 == y / 2)
{
printf("%d\n", count);
break;
}
}
if (count > 8)
printf("0\n");
}
}
0.0分
0 人评分
1124题解浏览:630 |
剪刀石头布 (C++代码)浏览:1811 |
勾股数 (C语言代码)浏览:830 |
母牛的故事 (C语言代码)浏览:625 |
2004年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:627 |
三进制小数 (C语言代码)浏览:903 |
P1044 (C++代码)浏览:550 |
Manchester-字符逆序(稳,附带小问题)浏览:5076 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:528 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:923 |