2018年1月18日 星期四

UVA Q10812 - Beat the Spread!

#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
int a,b,c,d,e;
cin>>a;
for(int x=1;x<=a;x++){
    cin>>b>>c;
    if((b+c)%2==0&&(b-c)%2==0&&(b+c)>=0&&(b-c)>=0){
        cout<<(b+c)/2<<" "<<(b-c)/2;
    }else{
        cout<<"impossible";
    }
    cout<<endl;
}

system("pause");
return 0;
}

沒有留言:

張貼留言