题解 | #守形数#

守形数

https://www.nowcoder.com/practice/99e403f8342b4d0e82f1c1395ba62d7b

#include <stdio.h>

int main() {
    int a;
    while (scanf("%d", &a) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to 
        //printf("%d\n", a);
        unsigned int b=a*a;
        while(1&&a>0){
            if(a%10!=b%10){
                printf("%s","No!\n");
                return 0;
            }
            a/=10;
            b/=10;
        }
        printf("%s","Yes!\n");
    }
    return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务