POJ 2301
#include<iostream> #include<stdio.h> using namespace std; int main() { //freopen("acm.acm","r",stdin); int i; int s; int d; int num; cin>>num; while(num--) { cin>>s; cin>>d; for(i = s; i >= (s-1)/2; i --) { if(i - (s - i) == d) { cout<<i<<" "<<s - i<<endl; break; } } if(i == (s-1)/2 - 1) cout<<"impossible"<<endl; } }