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;
    }
    
    • 0
      @ 2026-6-7 19:55:50

      #include <bits/stdc++.h> using namespace std;

      int main() { int a, b, c, d; cin >> a; b = a / 100; c = (a / 100 - a % 10) / 10; d = a % 10; if (b * b * b + c * c * c + d * d * d == a) { cout << "YES"; } else { cout << "NO"; } return 0; }

      • 1

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

      信息

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