Source: Cattle-off network
Given right-angled triangle in which the length of one side of n, is to construct your task remaining two sides, so that it can form three sides of a right triangle.
Input Description:
an integer n.
Output Description:
other two sides b, c. The answer is not unique, as long as any set of output that is reasonable, if you can not make construction output -1.
Example 1
Input
Copy
3
Output
Copy
45
Example 2
input
Copy
4
Output
Copy
35
Note:
0 <= n-<= 1E9
1<=b,c<=1e18
n, b, c are integers
#include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
if(n<=2)
cout << "-1" << " " << "-1" << endl;
if(n%2)
cout<<(n*n+1)/2<<' '<<(n*n-1)/2<<endl;
else
cout<<(n*n+4)/4<<' '<<(n*n-4)/4<<endl;
return 0;
}