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

太假了,浪费我的WA

Posted by wangxp at 2010-09-06 01:46:49 on Problem 2301
这样能过:
#include<stdio.h>

int main()
{
	int n,s,d;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d%d",&s,&d);
		if(s<d||(s-d)%2||(s+d)%2) printf("impossible\n");
		else
		{
			int a=(s+d)/2;
			int b=(s-d)/2;
			printf("%d %d\n",a,b);
		}
	
	}
	return 0;

}


这样却WA:
#include<stdio.h>

int main()
{
	int n,s,d;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d%d",&s,&d);
		if(s<d+2||(s-d)%2||(s+d)%2) printf("impossible\n");
		else
		{
			int a=(s+d)/2;
			int b=(s-d)/2;
			printf("%d %d\n",a,b);
		}
	
	}
	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