将200以内数的三次方打表,四重循环暴力判断
代码如下:
#include <bits/stdc++.h> using namespace std; int x[205]; int main() { for(int i=1;i<=200;++i) x[i]=i*i*i; for(int a=6;a<=200;++a) for(int b=2;b<=200;++b) for(int c=b+1;c<=200;++c) for(int d=c+1;d<=200;++d) if(!(x[a]-x[b]-x[c]-x[d])) cout<<"Cube = "<<a<<", Triple = ("<<b<<","<<c<<","<<d<<")"<<endl; return 0; }