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;
}


相关文章
HDU 1506 Largest Rectangle in a Histogram(单调栈)
HDU 1506 Largest Rectangle in a Histogram(单调栈)
|
人工智能
POJ 2299 Ultra-QuickSort(树状数组+离散化+求逆序数)
POJ 2299 Ultra-QuickSort(树状数组+离散化+求逆序数)
POJ-2389,Bull Math(大数乘法)
POJ-2389,Bull Math(大数乘法)
|
算法 Go
HDU-1548,A strange lift(Dijkstra)
HDU-1548,A strange lift(Dijkstra)
|
Java Go
POJ 1163 The Triangle
POJ 1163 The Triangle
112 0

热门文章

最新文章