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

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

 
}