Pages

Saturday, June 2, 2012

10812 - Beat the Spread!


//
// main.cpp
// Problem D: Beat the Spread!
// Created by Panks on 28/05/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{

int t, a, b;
cin>>t;
while (t--) {
cin>>a>>b;
if(a>=b&&a>=0&&b>=0&&((a+b)%2==0))
{
int c=(a+b)/2;
cout<<c<<" "<<a-c<<endl;

}else{
cout<<"impossible\n";
}
}
return 0;
}

No comments:

Post a Comment