poj 2301 Beat the Spread!

简介:

刷呀刷。。。


AC的代码:

#include <stdio.h>

int main()
{
	int n;
	int s,d;
	int a;   //Team a's score

	scanf("%d",&n);

	while(n--)
	{
		scanf("%d%d",&s,&d);
		if((s+d)%2!=0)
		{
			printf("impossible\n");
			continue;
		}

		a=(s+d)/2;

		if(s-a<0)
		{
			printf("impossible\n");
			continue;
		}

		printf("%d %d\n",a,s-a);
	}
	
	return 0;
}


相关文章
|
网络架构
POJ 3250 Bad Hair Day、POJ 2796 Feel Good(单调栈)
POJ 3250 Bad Hair Day、POJ 2796 Feel Good(单调栈)
HDOJ 1194 Beat the Spread!(简单题)
HDOJ 1194 Beat the Spread!(简单题)
140 0
poj 1862 Stripies 【优先队列】
点击打开题目 Stripies Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 12587   Accepted: 5957 Description Our...
947 0