1 solutions

  • 0
    @ 2025-11-5 19:09:01

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
    	for (int b=1; b<=9; b++)
    		for (int s=0; s<=9; s++)
    			for (int g=0; g<=9; g++)
    				if (b*b*b+s*s*s+g*g*g==100*b+10*s+g)
    					cout<<100*b+10*s+g<<endl;
    	return 0;
    }
    

    Pascal :

    var a,b,c,d:integer;begin
    
    for a:=100 to 999 do
    
    begin b:=a mod 10; c:=a mod 100 div 10; d:=a div 100;
    
    if b*b*b+c*c*c+d*d*d=a then
    
    writeln(a);
    
    end;
    
    end.
    
    • 1

    Information

    ID
    19199
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    (None)
    # Submissions
    0
    Accepted
    0
    Uploaded By