您的位置:首页 > 其它

完美立方

2017-08-06 17:04 225 查看
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    cin>>n;

    for(int a=2;a<=n;a++)

        for(int b=2;b<a;b++)

            for(int c=b;c<a;c++)

                for(int d=c;d<a;d++)

                {

                    int e=d*d*d+b*b*b+c*c*c;                

                    if(a*a*a==e)

                    cout<<"Cube = "<<a<<", Triple = ("<<b<<","<<c<<","<<d<<")"<<endl;

                }

    return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: