153是,因为1立方+3立方+5立方=153
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int sum=0;
int a[3];
int main(){
int divide(int *,int m);
for (int i=100;i<=999;i++ )
{
divide(a,i);
if(pow(a[0],3)+pow(a[1],3)+pow(a[2],3)==i) {sum++;
if(sum%5==0) cout<<endl;
cout<<i<<" ";}
}
return 0;
}
int divide(int *p,int m){
int i,j,k;
i=m/100;j=(m-100*i)/10;k=(m-100*i)%10;
*p=i;*(++p)=j;*(++p)=k;
}