2 条题解

  • 0
    @ 2026-6-13 17:38:39
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        int n;
        cin >> n;
    
        int a = n / 100;        // 百位
        int b = n / 10 % 10;    // 十位
        int c = n % 10;         // 个位
    
        int sum = a*a*a + b*b*b + c*c*c;
    
        if (sum == n)
            cout << "YES";
        else
            cout << "NO";
    
        return 0;
    }
    

    【入门】判断一个数是否是水仙花数

    信息

    ID
    30626
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    递交数
    7
    已通过
    7
    上传者