Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135520 杨启宏 100~999的水仙花数 C++ Accepted 1 MS 264 KB 547 2025-11-04 19:59:15

Tests(1/1):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ long long n=100,m=0,o=0,p=0,s=0; while(n<=999){ m=0; m=n%10; m=m*m*m; o=n%100/10; o=o*o*o; p=n/100; p=p*p*p; s=m+o+p; if(n==s){ cout<<n<<endl; } n++; } return 0; }