Beginner


私信TA

用户名:08153441

访问量:46170

签 名:

太难了

等  级
排  名 87
经  验 8566
参赛次数 2
文章发表 63
年  龄 0
在职情况 学生
学  校 CUMT
专  业 计算机科学与技术

  自我简介:

解题思路:





注意事项:





参考代码:

#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 人评分

  评论区