-->
当前位置:首页 > 题库

PROGRAMMING:Perfect Cube

Luz5年前 (2021-05-10)题库439
###Task description
An equation in the form of $$a ^ 3 = B ^ 3 + C ^ 3 + D ^ 3 $$is called a perfect cubic equation.
For example, $$12 ^ 3 = 6 ^ 3 + 8 ^ 3 + 10 ^ 3 $$.
Write a program to find all quadruples (a, B, C, d) for any given positive integer n (n ≤ 100),
Make $$a ^ 3 = B ^ 3 + C ^ 3 + D ^ 3 $$, where a, B, C, D are greater than 1, less than or equal to N, and B < = C < = D.
###Input format:
A positive integer n (n ≤ 100).
###Output format:
Each line outputs a perfect cube. The output format is:
Cube = a, Triple = (b,c,d)
Where the positions of a, B, C and D are substituted with the actual values of four tuples.
Please output from small to large according to the value of A. When the value of a in two perfect cubic equations is the same, the priority output with small value of B, the priority output with small value of C, and the priority output with small value of D are the same.
###Input example:
```in
twenty-four
```
###Output example:
```out
Cube = 6, Triple = (3,4,5)
Cube = 12, Triple = (6,8,10)
Cube = 18, Triple = (2,12,16)
Cube = 18, Triple = (9,12,15)
Cube = 19, Triple = (3,10,18)
Cube = 20, Triple = (7,14,17)
Cube = 24, Triple = (12,16,20)
```
###Title Source
Note: selected from openjudge website, online address: http://sdau.openjudge.cn/c/026/







answer:If there is no answer, please comment