結果

問題 No.2409 Strange Werewolves
ユーザー ニックネームニックネーム
提出日時 2023-08-11 21:41:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 497 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 57,728 KB
最終ジャッジ日時 2024-04-29 12:32:10
合計ジャッジ時間 5,400 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,752 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 495 ms
57,600 KB
testcase_04 AC 497 ms
57,728 KB
testcase_05 AC 264 ms
34,048 KB
testcase_06 AC 493 ms
57,728 KB
testcase_07 AC 487 ms
57,600 KB
testcase_08 AC 277 ms
35,968 KB
testcase_09 AC 311 ms
38,528 KB
testcase_10 AC 163 ms
23,808 KB
testcase_11 AC 56 ms
13,440 KB
testcase_12 AC 165 ms
24,320 KB
testcase_13 AC 275 ms
35,456 KB
testcase_14 AC 317 ms
40,192 KB
testcase_15 AC 305 ms
38,016 KB
testcase_16 AC 250 ms
32,896 KB
testcase_17 AC 65 ms
13,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x,y,z,w = map(int,input().split())
nmax = x+y; mod = 998244353; fa = [1]*(nmax+1); fi = [1]*(nmax+1)
for i in range(1,nmax): fa[i+1] = fa[i]*(i+1)%mod
fi[nmax] = pow(fa[nmax],mod-2,mod)
for i in range(nmax,0,-1): fi[i-1] = fi[i]*i%mod
def cmb(n,r): return fa[n]*fi[n-r]%mod*fi[r]%mod if 0<=r<=n else 0
if z==0: x,y,z,w = y,x,w,z
print(cmb(x,z)*y*fa[x+y-z-1]%mod)
0