문제2371--Mesmerization of The Count

2371: Mesmerization of The Count

실행시간 제한: 2 Sec  메모리사용 제한: 128 MB
제출: 126  통과: 29
[제출] [채점기록] [묻고답하기]

문제 설명

Sesame Street The Count has gone bad. He has escaped the hard-scrabble New York streets where he gained his fame and now haunts Oregon, surprising and killing unwary programmers throughout the state. Only one defense has been found: he is mesmerized by equations of the form

$(a/b)^{3} + (c/b)^{3} = n$

for natural numbers $a$, $b$, $c$, and $n$. For instance,

$(415280564497/348671682660)^3 + (676702467503/348671682660)^3 = 9$

stopped him in his tracks for a good $20$ minutes, giving mathematician Henry Dudeney enough time to escape a certain death. Unfortunately, large numbers like this are too hard to memorize, so shorter ones such as

$(2/1)^3 + (1/1)^3 = 9$

are better. Each such equation is only good for one mesmerization, so your job is to write a program that will generate new such equations.

In particular, you will be given $n$, and your job is to generate values for the natural numbers $a$, $b$, $c$ that satisfy the first equation. When multiple solutions exist, you should report the one with the minimum possible sum $a + b + c + b$, such that the value of $a/b$ is greater than or equal to the value of $c/b$. You may assume such a solution is unique. If you cannot find three natural numbers $a, b, c$ such that $a + b + c + b$ is less than $4,000$, you should print No value..

입력 설명

The input will be a sequence of lines; each line will contain a single natural number less than $10,000$. Input is terminated with a 0, which should not be processed.

출력 설명

For any valid equation you find, print the equation with the appropriate values for $a$, $b$, and $c$. A single space should precede and follow the + and the = in the equation. When no valid equation exists, print No value..

입력 예시 Copy

1
9
7
6000
0

출력 예시 Copy

No value.
(2/1)^3 + (1/1)^3 = 9
(5/3)^3 + (4/3)^3 = 7
(370/21)^3 + (170/21)^3 = 6000

출처/분류