链接:https://codeforces.com/problemset/problem/707/C
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.
For example, triples (3, 4, 5), (5, 12, 13) and (6, 8, 10) are Pythagorean triples.
Here Katya wondered if she can specify the length of some side of right triangle and find any Pythagorean triple corresponding to such length? Note that the side which length is specified can be a cathetus as well as hypotenuse.
Katya had no problems with completing this task. Will you do the same?
Input
The only line of the input contains single integer n (1 ≤ n ≤ 109)

本题要求根据输入的正整数n,找出一个构成毕达哥拉斯三元组的另外两个数m和k,使得n、m和k能构成一个直角三角形。若存在这样的三元组,则输出m和k,否则输出-1。题目提供了几个样例输入和输出,用于展示不同情况下的结果。
最低0.47元/天 解锁文章
469

被折叠的 条评论
为什么被折叠?



