100 120
300 380
no
370 371
1 #include<iostream> 2 3 using namespace std; 4 5 int main(){ 6 int low, high; 7 while (cin >> low >> high){ 8 int count = 0; 9 int d = 0; 10 for (d = low; d <= high; d++){ 11 int a = d / 100; 12 int b = (d - a * 100) / 10; 13 int c = (d - a * 100 - b * 10); 14 if (d == a*a*a + b*b*b + c*c*c){ 15 if (count == 0){ 16 cout << d; 17 } 18 else{ 19 cout << " " << d; 20 } 21 count++; 22 } 23 } 24 if (count == 0){ 25 cout << "no"; 26 } 27 cout<< endl; 28 } 29 return 0; 30 }
原文:https://www.cnblogs.com/tangyimin/p/10547336.html