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: 2016210402116
In contest: 1084

#include<string.h>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
void main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int n,f=0;
		scanf("%d",&n);
		if(n<5)
		{
			if(n!=2&&n!=3)
			printf("WA\n");
			else if(n==2)
				printf("1 0\n");
			else
				printf("0 1\n");
		}
		else
		{
			int i=0,j=0;
			for(i=0;i*2<n;++i)
			{
				for(j=0;i*2+j*3<=n;++j)
				{
					if((i*2+j*3)==n)
					{
						printf("%d %d\n",i,j);
						f=1;
						break;
					}
					if((i*2+j*3)==n)
						break;
				}
				if((i*2+j*3)==n)
						break;
			}
			if(f==0)
				printf("WA\n");
		}
	}
}