結果
問題 |
No.1771 A DELETEQ
|
ユーザー |
👑 |
提出日時 | 2021-12-03 12:26:46 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 279 ms / 3,500 ms |
コード長 | 598 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 73,220 KB |
実行使用メモリ | 64,896 KB |
最終ジャッジ日時 | 2024-07-05 16:47:37 |
合計ジャッジ時間 | 7,296 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 RE * 12 |
ソースコード
#include <stdio.h> const unsigned int Mod = 998244353; unsigned int memo[4001][4001] = {{1}}; unsigned int 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 i, x, y; long long ans = 0; scanf("%d %d", &x, &y); for (i = 0; i <= x && i <= y; i++) ans += recursion(x - i, y - i); printf("%lld\n", ans % Mod); fflush(stdout); return 0; }