You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
310 B
25 lines
310 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int fun(int n) {
|
|
int b=n/100;
|
|
int s=n/10%10;
|
|
int g=n%10;
|
|
int sum=b*b*b+s*s*s+g*g*g;
|
|
if(sum==n)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
int main() {
|
|
int start=100,stop=380;
|
|
for(int i=start; i<=stop; i++) {
|
|
if(fun(i)==1) {
|
|
printf("%d ",i);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|