C. Pythagorean Triples
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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) — the length of some side of a right triangle.

Output

Print two integers m and k (1 ≤ m, k ≤ 1018), such that n, m and k form a Pythagorean triple, in the only line.

In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.

Examples
Input
3
Output
4 5
Input
6
Output
8 10
Input
1
Output
-1
Input
17
Output
144 145
Input
67
Output
2244 2245
Note

Illustration for the first sample.

看了好多个题解,感觉这个比较容易懂,这个题真的好锻炼思维。。。打死也想不到。。。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm> using namespace std; int main()
{
long long n;
while(~scanf("%lld",&n)){
if(n<=){
printf("-1\n");
}else{
if(n*n&){
printf("%lld %lld\n",(n*n-)/,(n*n+)/);
}else{
printf("%lld %lld\n",n*n/-,n*n/+);
}
}
} return ;
}

codeforces-707 C. Pythagorean Triples的更多相关文章

  1. codeforces 707C C. Pythagorean Triples(数学)

    题目链接: C. Pythagorean Triples time limit per test 1 second memory limit per test 256 megabytes input ...

  2. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  3. 【Codeforces 707C】Pythagorean Triples(找规律)

    一边长为a的直角三角形,a^2=c^2-b^2.可以发现1.4.9.16.25依次差3.5.7.9...,所以任何一条长度为奇数的边a,a^2还是奇数,那么c=a^2/2,b=c+1.我们还可以发现, ...

  4. Codeforces Round #368 (Div. 2) C. Pythagorean Triples(数学)

    Pythagorean Triples 题目链接: http://codeforces.com/contest/707/problem/C Description Katya studies in a ...

  5. Codeforces Round #368 (Div. 2) C. Pythagorean Triples 数学

    C. Pythagorean Triples 题目连接: http://www.codeforces.com/contest/707/problem/C Description Katya studi ...

  6. Pythagorean Triples

    Pythagorean Triples time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. Pythagorean Triples 707C

    Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theor ...

  8. Pythagorean Triples毕达哥斯拉三角(数学思维+构造)

    Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pytha ...

  9. codeforces707C:Pythagorean Triples

    Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pytha ...

随机推荐

  1. 基于AllegroGraph实现Protege设计知识库模型的存储步骤

    在 https://www.w3.org/2001/sw/wiki/Protege 网站看到以下词语: “.....The Protégé platform supports two main way ...

  2. C#实现无物理边距 可打印区域的绘图\打印 z

    经常在开发实际的应用程序中,需要用到图形绘制和打印程序.如何实现完整的精确打印和绘图是需要注意许多细节地方的.最近在遇到打印问题的时候,仔细研究一阵,总结这篇博文,写得有点杂乱,看文要还请费点神. 基 ...

  3. Jmeter压力测试(简单的http请求)-实例

    服务端系分提供的某接口样例为: 评估后可采用使用jmeter进行压力测试的步骤为: 启动jmeter:在bin下点击jmeter.bat,运行jmeter 2. 创建测试计划: 默认启动jmeter时 ...

  4. Css3 实现循环留言滚动效果(一)

    一.常见留言滚动效果示例 html代码 <div class="runList"> <div class="runitem"> < ...

  5. Skyline中加载WMTS地图

    Skyline中默认是Bing地图,必应虽然免费无偏移,但在国内的影像质量并不是很好.不用担心,Skyline支持多种影像图层,包括WFS.WMS.WMTS地图服务.使用地图作为底图有两个好处: (1 ...

  6. Visual Studio进行Web性能测试- Part II

    Visual Studio进行Web性能测试- Part II 2012-08-31 14:34 by 知平软件, 7557 阅读, 5 评论, 收藏, 编辑 原文作者:Ambily.raj 对于一个 ...

  7. JAVA与C#的区别

    Java和C#都是编程的语言,它们是两个不同方向的两种语言 相同点: 他们都是面向对象的语言,也就是说,它们都能实现面向对象的思想(封装,继承,多态) 区别: 1.c#中的命名空间是namespace ...

  8. Chrome 控制台报错Unchecked runtime.lastError: The message port closed before a response was received

    Chrome浏览器控制台报错提示 Unchecked runtime.lastError: The message port closed before a response was received ...

  9. [转]Anatomy of a Program in Memory

    Memory management is the heart of operating systems; it is crucial for both programming and system a ...

  10. Atitit 烈火计划进展报告 r61

    Atitit 烈火计划进展报告 r61 1. 烈火计划主要包括几个东西 1 1.1. 2014.12 邮箱编码读取 1 1.2. 2017.1  垂直领域图片下载器  草料图片下载器 1 1.3. q ...