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

/*该程序功能:输入一个正整数n,计算下列表达式:s=1!+2!+3!+4!+...+n! 的值,并输出。*/
#include <stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
struct name {
	char c[25];
	int a;
	int b;
};
//int comp(const void *p,const void *q){
	//return (*(* ))
//}
int main()
{
	struct name s[110],y;
	char c;
	int a,b,t,n,i,j;
	scanf("%d",&t);
	while(t--){
		scanf("%d",&n);
		if(n<2)printf("WA");
		else if(n%3==0)printf("0 %d",n/3);
		else if(n%3==1)printf("2 %d",(n-4)/3);
		else printf("1 %d",n/3);
		printf("\n");
	}
	return 0;
	
}