TypeDB Forces 2023 (Div. 1 + Div. 2, Rated, Prizes!) Editorial - Codeforces
题目大意:给出一整数n,求两非零正整数x,y使
1<=n<=1e9
思路:可以发现,当x=1时,原式变为2*y=n,所以当n是偶数时,1,n/2即为答案,当n是奇数时,若x,y一奇一偶,都是偶数,矛盾,若都为偶数,同样得出来的是偶数,矛盾,若都为奇数,
都为奇数,相加为偶数,矛盾,所以n是奇数时无解
//#include<__msvc_all_public_headers.hpp>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
if (n & 1)
{
cout << -1 << endl;
}
else
{
cout << 1 << " " << n / 2 << endl;
}
}
return 0;
}