题解 | 守形数

守形数

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

#include <iostream>
using namespace std;

int main() {
    int n;
    while (cin >> n) {
        int count = 0, t = n;
        while (t) {
            count++;
            t /= 10;
        }
        t = 1;
        while (count--) {
            t *= 10;
        }
        if (n * n % t == n) {
            cout << "Yes!" << endl;
        } else {
            cout << "No!" << endl;
        }
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

一表renzha:手写数字识别就是一个作业而已
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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