给两数之和和两数之差,求两数,两数还必须同奇偶
1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 int a,b,t; 6 cin>>t; 7 while(t--) 8 { 9 cin>>a>>b; 10 int x = ( a + b ) / 2; 11 int y = ( a - b ) / 2; 12 if((a-b)%2||(a+b)%2||x<0||y<0) puts("impossible"); 13 else cout<<x<<" "<<y<<endl; 14 } 15 }