1 solutions
-
0
C :
#include<stdio.h> void main(){ int i; for(i=100;i<=999;i++){ int a=i%1000/100; int b=i%100/10; int c=i%10/1; if(a*a*a+b*b*b+c*c*c==i){ printf("%d\n",i); } } }
C++ :
#include<iostream> #include<math.h> using namespace std; int main(){ int i = 100; while(i <= 999){ int a = i / 100; int b = i / 10 % 10; int c = i % 10; if(a * a * a + b * b * b + c * c * c == i){ cout<<i<<endl; } i++; } return 0; }
Python :
for n in range(100,1000): a=n//100 b=n//10%10 c=n%10 if n==a*a*a+b*b*b+c*c*c: print(n)
- 1
Information
- ID
- 10841
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By