P8828 [ChuanZhi Cup #3 Practice Contest] Right Triangle.
Description
The two legs of a right triangle are $a, b (a \le b)$, its hypotenuse is $c$, and $a, b, c$ are all positive integers.
Now we already know the hypotenuse length $c$. What are the lengths of the two legs of this right triangle?
Input Format
Input one integer $c (1 \le c \le 1.41 \times 10^4)$.
Output Format
Output two integers $a, b$ as the answer. It is guaranteed that an integer solution exists. If there are multiple possible answers, make sure $a$ is as small as possible.
Explanation/Hint
Translated by ChatGPT 5