POJ 2301 Beat the Spread

題目鏈接

大水題。。

代碼

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a<b||(a+b)%2){
            cout<<"impossible\n";
        }
        else{
            cout<<(a+b)/2<<' '<<a-(a+b)/2<<endl;
        }
    }
    return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章