Non-great equations

2.5

6 votes
, Basic Math, C++, Math
Problem

Fermat's last theorem states that for any natural number n>2, the equation, an+bn=cn, contains no solutions in the non-zero integers a, b, and c specifically in a3+b3c3. However, you decided to change it a little. After you have the equation a2+b3=c2, that is called a Non-Great Equation (NGE). For a given b, can you find any pair a, c that satisfies NGE.

Note: Unlike Fermat, b can be 0 and negative numbers and also 0a, c1018.

Input format

The single line contains one integer b (0|b|109).

Output format

Print a, c such that a2+b3=c2. If there are several solutions, print any one of them.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

3^2+3^3=9+27=36=6^2

Editor Image

?