1 solutions
-
0
C++ :
#include <iostream> #include <cstdio> using namespace std; int main() { int n,count=0; cin>>n; for(int i=100;i<=n;i++) { int ge,shi,bai; ge=i%10; shi=(i/10)%10; bai=i/100; if(i==(ge*ge*ge+shi*shi*shi+bai*bai*bai)) { count++; } } cout<<count<<endl; return 0; }Pascal :
program p21120; var i,n,a,b,c,d:integer; begin readln(n); for i:=100 to n do begin a:=i div 100; b:=i div 10 mod 10; c:=i mod 10; if a*a*a+b*b*b+c*c*c=i then inc(d); end; writeln(d); end.
- 1
Information
- ID
- 20046
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By