5 solutions
-
0
#include<stdio.h> #include<math.h>
int main() { //如何判断是否为水仙花数? int x,y,z; int judger1, judger2; scanf_s("%1d%1d%1d",&x,&y,&z); judger1 = pow(x,3) + pow(y,3) + pow(z,3); judger2 = x * 100 + y * 10 + z * 1;
if (judger1 == judger2) { printf("True"); } else if (judger1 != judger2) { printf("False"); }; return 0;
}
-
0
#include <stdio.h> #include <algorithm> #include <math.h> #include <vector> #include <iostream> using namespace std; int n; int main() { scanf("%d",&n); int m=n,ans=0; while(n) { int tmp=n%10; ans+=tmp*tmp*tmp; n/=10; } if(ans==m) printf("TRUE\n"); else printf("FALSE\n"); return 0; }
- 1
Information
- ID
- 42
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 883
- Accepted
- 310
- Uploaded By