Mark11


私信TA

用户名:Mark11

访问量:24110

签 名:

懒惰,傲慢,愤怒

等  级
排  名 381
经  验 5005
参赛次数 0
文章发表 47
年  龄 20
在职情况 学生
学  校 NorthWest University
专  业 S.E

  自我简介:

从头来过的苦逼

#include<stdio.h>
int turnover(int dec){
    int newd = 0;
    while(dec > 0){
        newd =newd * 10 + dec % 10;
        dec /= 10;
    }
    return newd;
}
int isOrNot(int dec){
    int newd = turnover(dec);
    if(dec == newd) return 1;
    else return 0;
}
int main(){
    int l, num, step;
    scanf("%d", &l);
    for(int i = 0; i < l; i++){
        step = 0;
        scanf("%d", &num);
        while(isOrNot(num) != 1){
            int newd = turnover(num);
            num += newd;
            step++;
            if(step > 8){
                step = 0;
                break;
            }
        }
        printf("%d\n", step);
    }
    return 0;
}
 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区