本文共 458 字,大约阅读时间需要 1 分钟。
题目意思就是输入n ,
求a,x,y,z,使的 a<=n,a>=1; x>1 且 z>=y>=x a的立方 = x的立方 + y的立方 +z的立方按格式输出a ,x, y, z
简单枚举即可,超级大水题。。。我错了是因为我一行写太多了。。。
#includeusing namespace std;void C_out(int a,int b,int c,int d){ cout<<"Cube = "< <<", Triple = ("<<<","< <<","< <<")"< >n; for(i=1;i<=n;i++){ for(x = 2;x<=i;x++){ for(y = x;y<=i;y++){ for(z = y;z<=i;z++){ if(i*i*i == x*x*x + y*y*y+z*z*z){ C_out(i,x,y,z); } } } } } return 0;}
转载地址:http://mtujn.baihongyu.com/