7 solutions
-
0
c
#include <stdio.h> #include <math.h> int main(){ int x,n,j; scanf("%d",&x); int t=x; int cnt=0; int sum=0; while (t != 0) { t /= 10; cnt++; } t=x; j=cnt; do { int a =pow(10, j); int b = t % a; n = b / pow(10, j - 1); sum+=pow(n, cnt); j--; } while (j != 0); printf(x==sum ? "TRUE":"FALSE"); return 0; }
-
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
- 963
- Accepted
- 339
- Uploaded By