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: 397ms
Memory: 1700kB
Author: TateBrown
In contest: 1084

#include<iostream>
#include<string.h>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<fstream>
#include<iomanip>
#include<stdlib.h>
#include<math.h>
using namespace std;
int main(){
	int T,n,x,y;
	bool flag;
	cin>>T;
	while(T--){
		x=9999;
		flag=false;
	cin>>n;
	for(int i=0;i<=n/2+1;i++){
		for(int j=0;j<=n/3+1;j++){
			if(i*2+j*3==n){
				flag=true;
				if(i<x){
			  x=i;
			  y=j;}
			}
		}
	}
	if(!flag)cout<<"WA"<<endl;
	else
		cout<<x<<" "<<y<<endl;
	}
return 0;
}