记录编号 200693 评测结果 AAAAAAAAAA
题目名称 Marisa 最终得分 100
用户昵称 Gravatardashgua 是否通过 通过
代码语言 C++ 运行时间 0.070 s
提交时间 2015-10-29 11:42:30 内存使用 8.03 MiB
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <iostream>
#include <algorithm>

template<class Num>void read(Num &x)
{
	char c; int flag = 1;
    while((c = getchar()) < '0' || c > '9')
		if(c == '-') flag *= -1;
	x = c - '0';
    while((c = getchar()) >= '0' && c <= '9')
		x = (x<<3) + (x<<1) + (c-'0');
	x *= flag;
	return;
}
template<class Num>void write(Num x)
{
	if(!x) {putchar('0');return;}
	if(x < 0) putchar('-'), x = -x;
	static char s[20];int sl = 0;
	while(x) s[sl++] = x%10 + '0',x /= 10;
    while(sl) putchar(s[--sl]);
}
const int Mod = 998244353, maxn = 1005, size = 1000;

long long f[maxn][maxn], ans[maxn];

void prework()
{
	f[0][0] = 1;
	
	for(int i = 1; i <= size; i++)
		for(int j = i*2; j <= size; j++)
		{
			f[i][j] = f[i - 1][j - 2] + (j > i ? f[i][j - i] : 0);
			f[i][j] %= Mod;
		}
	for(int i = 1; i <= size; i++)
	{
		for(int j = 1; j*2 <= i; j++)
			ans[i] += f[j][i]; 
		ans[i] %= Mod;	
	}	
}

int main()
{
	int T, n;
	
	freopen("card.in","r",stdin);
	freopen("card.out","w",stdout);

	read(T), prework();
	
	while(T--) read(n), write(ans[n]), puts("");	
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}