1 solutions

  • 1
    @ 2025-9-21 14:15:58
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	for(int a=1;a<=n;a++)
    	{
    		for(int b=2;b<=a;b++)
    		{
    			for(int c=b;c<=a;c++)
    			{
    				for(int d=c;d<=a;d++)
    				{
    					if(pow(a,3)==pow(b,3)+pow(c,3)+pow(d,3))
    					{
    						cout<<"Cube = "<<a<<", Triple = ("<<b<<","<<c<<","<<d<<")"<<endl; 
    					}
    				}
    			}
    		}
    	}
    	return 0;
    }
    
    
    • 1

    Information

    ID
    591
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    8
    Tags
    # Submissions
    16
    Accepted
    5
    Uploaded By