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

纪念我的第100题,HOHO

Posted by 304988557 at 2006-09-14 20:52:49 on Problem 2301
#include<iostream.h>
#include<string.h>
#include <stdio.h>
#include<math.h>
int main()
{
	int i,n,s,d,max,min;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>s>>d;
		for(max=s/2;max<=s;max++)
		{
			min=s-max;
			if(max-min==d)
			{
				cout<<max<<" "<<min<<endl;break;
			}
		}
		if(max>s) {cout<<"impossible"<<endl;}

	}

    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