You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
624 B
C++
31 lines
624 B
C++
#include <cstdio>
|
|
#include <vector>
|
|
using namespace std;
|
|
bool check(int x)
|
|
{
|
|
int a=x/100;
|
|
int b=x/10%10;
|
|
int c=x%10;
|
|
return x==(a*a*a+b*b*b+c*c*c);
|
|
}
|
|
int main()
|
|
{
|
|
int m,n;
|
|
vector<int> ans;
|
|
while(~scanf("%d%d",&m,&n))
|
|
{
|
|
ans.clear();
|
|
bool flag=false;
|
|
for(int i=m; i<=n; i++)
|
|
if(check(i))
|
|
ans.push_back(i);
|
|
if(ans.empty()) puts("no");
|
|
else{
|
|
for(int i=0;i<ans.size()-1;i++)
|
|
printf("%d ",ans[i]);
|
|
printf("%d\n",*ans.rbegin());
|
|
}
|
|
}
|
|
return 0;
|
|
}
|