結果

問題 No.2409 Strange Werewolves
ユーザー Akijin_007Akijin_007
提出日時 2023-08-11 21:37:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 570 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 72,832 KB
最終ジャッジ日時 2024-04-29 12:27:35
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 328 ms
64,512 KB
testcase_01 AC 333 ms
64,128 KB
testcase_02 AC 327 ms
64,256 KB
testcase_03 RE -
testcase_04 AC 325 ms
64,384 KB
testcase_05 AC 330 ms
64,768 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 331 ms
64,384 KB
testcase_09 AC 331 ms
64,512 KB
testcase_10 AC 331 ms
64,384 KB
testcase_11 AC 327 ms
64,640 KB
testcase_12 AC 334 ms
64,640 KB
testcase_13 AC 337 ms
64,256 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 330 ms
64,384 KB
testcase_17 AC 337 ms
64,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

X, Y, Z, W = map(int, input().split())
mod = 998244353

if Z == 0:
    X, Y = Y, X
    Z, W = W, Z

m = 3 * 10 ** 5 + 10

fac = [1] * (m + 1)
facinv = [1] * (m + 1)
for i in range(1, m+1):
    fac[i] = (fac[i-1] * i) % mod
    facinv[i] = (facinv[i-1] * pow(i, mod-2, mod)) % mod

def nCk(n, k):
    return (fac[n] * facinv[k] * facinv[n-k]) % mod

u = X - Z
v = Y - W

ans = nCk((u+v-1), u)
# print(u, v, ans)
ans = (ans * fac[X] * facinv[Z]) % mod
ans = (ans * fac[Y]) % mod


print(ans)





0