The equation A5+b5+c5+d5+e5=f5 has exactly one integer solution satisfying the 0<a≤b≤c≤d≤e≤f≤75. Please write a program to find out the solution:
1 usingSystem;2 3 namespacereversetheexponentiation4 {5 class Program6 {7 Static voidMain (string[] args)8 {9Program P =NewProgram ();Ten p.reversetheexponentiation (); One } A - voidreversetheexponentiation () - { the intA, B, C, D, E, F; - for(F = the; F >0; f--) - { - for(E =1; E <= F; e++) + { - for(D =1; D <= E; d++) + { A for(C =1; C <= D; C++) at { - for(B =1; B <= C; b++) - { - for(A =1; A <= B; a++) - { - if(Math.pow (A,5) + Math.pow (B,5) + Math.pow (C,5) + Math.pow (D,5) + Math.pow (E,5) = = Math.pow (F,5)) in { -Console.WriteLine ("A,b,c,d,e,f is: {0},{1},{2},{3},{4},{5}", A, B, C, D, E, F); to } + } - } the } * } $ }Panax Notoginseng } - } the } +}
View Code
Output:
Note: If the condition becomes 0≤a≤b≤c≤d≤e≤f≤75 there are many solutions, the output is as follows:
Solving equation a5+b5+c5+d5+e5=f5