1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int i,j,k,n; 6 for (n=100;n<1000;n++) 7 {i=n/100; 8 j=n/10-i*10; 9 k=n%10; 10 if (n == i*i*i + j*j*j + k*k*k) 11 cout<<n<<endl; 12 } 13 return 0; 14 }
时间: 2024-10-29 19:07:27
1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int i,j,k,n; 6 for (n=100;n<1000;n++) 7 {i=n/100; 8 j=n/10-i*10; 9 k=n%10; 10 if (n == i*i*i + j*j*j + k*k*k) 11 cout<<n<<endl; 12 } 13 return 0; 14 }