結果
| 問題 | 
                            No.1771 A DELETEQ
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2021-12-03 12:16:05 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 333 ms / 3,500 ms | 
| コード長 | 604 bytes | 
| コンパイル時間 | 125 ms | 
| コンパイル使用メモリ | 29,696 KB | 
| 実行使用メモリ | 127,360 KB | 
| 最終ジャッジ日時 | 2024-07-05 16:33:07 | 
| 合計ジャッジ時間 | 5,738 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 RE * 12 | 
ソースコード
#include <stdio.h>
const int Mod = 998244353;
long long memo[4001][4001] = {};
long long recursion(int x, int y)
{
	if (memo[x][y] != 0) return memo[x][y];
	else memo[x][y] = 0;
	if (x > 0) memo[x][y] += recursion(x - 1, y);
	if (y > 0) memo[x][y] += recursion(x, y - 1);
	if (x > 0 && y > 0) memo[x][y] += recursion(x - 1, y - 1) * 2;
	memo[x][y] %= Mod;
	return memo[x][y];
}
int main()
{
	int x, y;
	scanf("%d %d", &x, &y);
	memo[0][0] = 1;
	
	int i;
	long long ans = 0;
	for (i = 0; i <= x && i <= y; i++) ans += recursion(x - i, y - i);
	printf("%lld\n", ans % Mod);
	fflush(stdout);
	return 0;
}