文章
76
粉丝
0
获赞
448
访问
18.0k
#include<iostream>
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() {
while (true) {
int m, n;
cin >> m >> n;
if (m == 0 && n == 0) break;
bool flag = false;
for (int i = m; i <= n; i ++ ) {
if (check(i)) {
cout << i << ' ';
flag = true;
}
}
if (!flag) cout << "no" << endl;
else cout << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发