PKU 2301 Beat the Spread!
http://poj.org/problem?id=2301
連立方程式を解くだけ。
説明親切だし、スーパーボールのルールを調べる必要もないので安心。
main(){ int t; cin>>t; while(t--){ int s,d; cin>>s>>d; int x=(s+d)/2,y=s-x; if(x>=0 && y>=0 && x+y==s && x-y==d)cout<<x<<' '<<y<<endl; else cout<<"impossible"<<endl; } }