1604.Xu1024’s treasure chest

Time Limit: 1s Memory Limit: 256MB

Xu1024 is a poor student. One day, Xu1024 found a treasure chest, but he didn't have the password. The treasure chest said: if you want to get the treasure of the pirate king, you need to find three numbers $A,
B, C$ that the pirate king likes, making $A \lt B \lt C$ and $B^2 - A^2 = C^2 - B^2$.

Because Xu1024 has his own favorite number, he decided to take this number as $A$. now you need to help him find the other two numbers $B$ and $C$ to open the treasure chest. Because Xu1024 doesn't like the number which is too large, the absolute value of the numbers $A$ will not be greater than $100,000,000$. What's more, the absolute value of the numbers $B$ and $C$ you find shouldn't exceed $1,000,000,000$.

Now I will tell you the number $A$. Please help Xu1024 find out the integer $B$ and $C$ satisfied that $A \lt B \lt C$ and $B^2 - A^2 = C^2 - B^2$.

If no answer can be found, output "-1".

Input Format(From the terminal/stdin)

The first line contains an integer which is Xu1024's favorite number.

Output Format(To the terminal/stdout)

If the answer exists, ouput two integers: $B$ and $C$, seperated by a space.

If no answer can be found, output "-1".

Sample Input 1

Copy
7
 \n

Sample Output 1 special judge

Copy
13 17
  ·  \n

Sample Input 2

Copy
8599
    \n

Sample Output 2 special judge

Copy
50005 70193
     ·     \n

Hints

For the first case, $13^2-7^2=17^2-13^2=120$.

For the second case, $50005^2-8599^2=70193^2-50005^2=2426557224$.

Source: 2019 HNU新生赛

Submit

请先 登录

© 2025 FAQs