#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long int n,a, b, c, x, y, i;
while(cin >>n)
{
for(i=1; i<=n; i++)
{
cin >> x >> y;
a = (x+y)/2;
b = x-a;
if(a+b == x && a- abs(b) == y)
{
cout << a << " " << b << endl;
}
else
{
cout << "impossible" << endl;
}
}
}
return 0;
}
#include<cmath>
using namespace std;
int main()
{
long long int n,a, b, c, x, y, i;
while(cin >>n)
{
for(i=1; i<=n; i++)
{
cin >> x >> y;
a = (x+y)/2;
b = x-a;
if(a+b == x && a- abs(b) == y)
{
cout << a << " " << b << endl;
}
else
{
cout << "impossible" << endl;
}
}
}
return 0;
}
Comments
Post a Comment