2 条题解

  • -1
    @ 2026-6-12 17:31:53

    50.求出100至999范围内的所有水仙花数。

    100-999范围内的水仙花数如下:

    153、370、371、407。

    我们可以这样:

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        cout<<"153"<<endl<<"370"<<endl<<"371"<<endl<<"407"<<endl;
        return 0;
    }
    
    
    • -3
      @ 2026-2-10 14:54:56

      50.水仙花数(广赋张老师的题解)

      #include <bits/stdc++.h>
      using namespace std;
      int main(){
          for(int a=100;a<999;a++){
              int bai = a/100;
              int shi = a%100/10;
              int ge = a%10;
              if(a == bai*bai*bai+shi*shi*shi+ge*ge*ge){
                  cout << a <<endl;
              }
          }
        return 0;
      }
      
      • 1

      求出100至999范围内的所有水仙花数。

      信息

      ID
      50
      时间
      1000ms
      内存
      16MiB
      难度
      2
      标签
      递交数
      108
      已通过
      46
      上传者