一个数的(勾股数)组

大概

一开始还以为是勾股 的数组呢、、
题目-->codeforces
求一个数所在的任意勾股数组
算了,不胡扯扯了,还是看原博客吧
应该是中国人写的,翻译友好

#include <iostream>
#define ll long long
using namespace std;
int main() {
	ll n,a,b;
	cin>>n;
	if(n==1||n==2) {
		puts("-1");
		return 0;
	}
	if(n&1) {
		n=n*n-1;
		a=n/2;
		b=a+1;
	} else {
		n=n*n/2-2;
		a=n/2;
		b=a+2;
	}
	cout<<a<<" "<<b<<"
";
	return 0;
}
原文地址:https://www.cnblogs.com/dsrdsr/p/10263812.html