| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
注意这题要考虑 (s-d)是奇数的情况就可以了…………#include<iostream>
using namespace std;
int main()
{
int n;
int sum;
int mul;
cin>>n;
for(int i =0; i<n; i++)
{
cin>>sum>>mul;
if(sum<mul)
cout<<"impossible"<<endl;
else if((sum-mul)%2==0)
cout<<(sum+mul)/2<<" "<<(sum-mul)/2<<endl;
else cout<<"impossible"<<endl;//如果s-d是奇数也是impossible……
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator