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

#include<stdio.h>
#include<math.h>
int main(void) {
	int t, n, jmm, swh, x, y, i;
	scanf("%d", &t);
	while(t--) {
		scanf("%d", &n);
		x=n%2;
		y=n%3;
		if((x%3!=0)&&(y%2!=0)) {
			if(n==1)
				printf("WA");
			else
				printf("2 %d", (n-4)/3);
		}
		else if((y%2!=0)&&(x%3==0)) {
			if(n==4)
				printf("2 0");
			else
				printf("2 %d", (n-4)/3);
		}
		else {
			swh=n/3;
			jmm=(n-swh*3)/2;
			printf("%d %d", jmm, swh);
		}
		printf("\n");
	}
	return 0;
}