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

#include <stdio.h>
#include<stdlib.h>
int main()
{	
	int T;
	scanf("%d",&T);
	while(T--){
		int N;
		int x,y,flag,c1,c2;
		c1=c2=0;
		flag=1;
		scanf("%d",&N);
		if(N<=5000&&N>=0){
		for(x=N/2;x>=0;x--){
			for(y=0;y<=N/3;y++){
				if(x*2+y*3==N){
					c1=x;
					c2=y;
					flag=0;
					break;}
			}

		}
	
	     if(flag==1)
			 printf("WA\n");
		 if(flag==0)
			 printf("%d %d\n",c1,c2);
	
		}
	}
	return 0;
}