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

#include<stdio.h>
void main()
{
	int n,i,j,a,b,x,y,p,t,q;
	scanf("%d",&t);
	while(t--)
	{
	scanf("%d",&n);
	x=n/2;
	y=n/3;
	p=0;
	q=0;
	for(i=0;i<=x;i++)
	{
		for(j=0;j<=y;j++)
		{
			if(i*2+j*3==n)
			{
				p=1;
				break;
			}
		}
			if(p)
				break;
	}
	if(!p)
	{
		printf("WA\n");
	}
	else
	{
		for(a=0;a<=x;a++)
		{
			for(b=0;b<=y;b++)
			{
				if(a*2+b*3==n)
				{
					q=1;
					break;
				}
			}
			if(q)
				break;
		}
		printf("%d %d\n",a,b);
	}
	}
}