Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

注意这题要考虑 (s-d)是奇数的情况就可以了…………

Posted by summery at 2006-04-07 16:59:20 on Problem 2301
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator