Start: Jan, 04, 2017 19:40:00
2016年秋季学期程序设计基础期末考试
End: Jan, 04, 2017 21:40:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 1ms
Memory: 1092kB
Author: 2016210402085
In contest: 1084

#include<stdio.h>
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int N;
		scanf("%d",&N);
		int x,y,flag = 0;
		if(N % 3 == 0)
		{
			y = N / 3;
			x = 0;
		}
		else
		{
			y = N / 3;
			x = (N-3*y) / 2;
			while((N-3*y) < 2)
			{
				y = y-1;
				x = (N-3*y) / 2;
				if((N-3*y)%2 != 0)
					flag = 1;
			}
		}
		if(x<0 || y <0)
			flag = 1;
		if(flag == 0)
			printf("%d %d\n",x,y);
		else
			printf("WA\n");
	}
}