题目链接:http://poj.org/problem?id=1543
//C++代码
#include<iostream>
using namespace std;
int main(){
int n,i,j,k,t;
cin>>n;
for(i=3;i<=n;i++){
int a=i*i*i;
for(j=2;j<i;j++){
int b=j*j*j;
for(k=j;k<i;k++){
int c=k*k*k;
if(a<=b+c) break;
for(t=k;t<i;t++){
int d=t*t*t;
if(a<b+c+d) break;
if(a==b+c+d) cout<<"Cube = "<<i<<", Triple = ("<<j<<","<<k<<","<<t<<")"<<endl;
}
}
}
}
return 0;
}