Codeforces 707C. Pythagorean Triples Solution
Solve in C++:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE
- ///Islamic University,Bangladesh
- #include <iostream>
- using namespace std;
- int main()
- {
- long long int n;
- while(cin>>n)
- {
- if(n<3)
- cout<<"-1"<<endl;
- else
- {
- if(n%2==1)
- {
- cout<<((n*n)-1)/2<<" "<<((n*n)+1)/2<<endl;
- }
- else
- {
- cout<<((n*n)/4)-1<<" "<<((n*n)/4)+1<<endl;
- }
- }
- }
- }
No comments