Advertisement
Oibek

Pythagorean triples

Jul 8th, 2018
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long ll;
  5.  
  6. int main() {
  7.     ll n; cin >> n;
  8.     if (n <= 2) cout << -1;
  9.     else if (n % 2 == 0)
  10.     {
  11.         cout << n*n/4 - 1 << " " << n*n/4 + 1;
  12.     } else
  13.     {
  14.         cout << (n*n+1)/2 - 1 << " " << (n*n+1)/2;
  15.     }
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement