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

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(){
	int n,m;
	int p,t,q;
	int flag=0;
	scanf("%d",&n);
	while(n--){
	flag=0;
	scanf("%d",&m);
	for(p=0;p<=(m/2)+1;p++){
		for(t=0;t<=(m/3)+1;t++){
			if(p*2+t*3!=m) {
				continue;
				
			}
			if(p+t>5000) continue;
			else {
				printf("%d %d\n",p,t);
				flag=1;
				break;
			}
		}
		if(flag==1) break;
	}

	if(flag==0) printf("WA\n");
	//if(flag==0&&m==0) printf("0 0\n");
	}
	
	
}