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: 564ms
Memory: 1092kB
Author: 2016210402095
In contest: 1084

#include <stdio.h>
int main ()
{
	int t,n,x,y,i,j,flag,k,min,oy;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		flag=0;
		i=0;j=0;
		min=n/2;
		for(x=0;x<=n/2;++x)
		{
			for(y=0;y<=n/2;++y)
			{
				if(2*x+3*y==n)
				{
					flag=1;
					if(x<min)
					{
						min=x;
						oy=y;
					}
					else
						continue;
				}
			}
		}
		if(flag==0)
			printf("WA\n");
		else
			printf("%d %d\n",min,oy);
	}
	
}