結果

問題 No.2033 Chromatic Duel
ユーザー qwewe
提出日時 2025-05-14 12:47:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 81,992 KB
実行使用メモリ 63,720 KB
最終ジャッジ日時 2025-05-14 12:49:01
合計ジャッジ時間 3,622 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 8 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

max_fact = 2 * 10**5 + 10
fact = [1] * (max_fact + 1)
for i in range(1, max_fact + 1):
    fact[i] = fact[i-1] * i % MOD

inv_fact = [1] * (max_fact + 1)
inv_fact[max_fact] = pow(fact[max_fact], MOD-2, MOD)
for i in range(max_fact - 1, -1, -1):
    inv_fact[i] = inv_fact[i+1] * (i+1) % MOD

def comb(n, k):
    if n < 0 or k < 0 or n < k:
        return 0
    return fact[n] * inv_fact[k] % MOD * inv_fact[n - k] % MOD

N, B, W = map(int, input().split())

if W == N - 3 * B and N >= 3 * B and W >= 0:
    n = N - 2 * B
    print(comb(n, B) % MOD)
else:
    print(0)
0