結果

問題 No.2409 Strange Werewolves
ユーザー ryohei22ryohei22
提出日時 2023-08-12 01:34:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 57,472 KB
最終ジャッジ日時 2024-04-29 16:20:57
合計ジャッジ時間 1,866 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
51,968 KB
testcase_01 AC 46 ms
57,216 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 54 ms
57,216 KB
testcase_04 AC 52 ms
56,960 KB
testcase_05 AC 46 ms
57,216 KB
testcase_06 AC 54 ms
57,472 KB
testcase_07 AC 53 ms
57,088 KB
testcase_08 AC 50 ms
57,088 KB
testcase_09 AC 51 ms
57,216 KB
testcase_10 AC 47 ms
57,088 KB
testcase_11 AC 46 ms
57,344 KB
testcase_12 AC 47 ms
57,088 KB
testcase_13 AC 47 ms
57,472 KB
testcase_14 AC 50 ms
56,960 KB
testcase_15 AC 51 ms
56,960 KB
testcase_16 AC 50 ms
57,216 KB
testcase_17 AC 46 ms
57,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353


def my_factorial(a):
	ret = 1
	for i in range(1, a+1):
		ret *= i
		ret %= MOD

	return ret


def comb(a, b):
	ret = my_factorial(a)
	d = my_factorial(b) * my_factorial(a-b)
	d %= MOD

	ret = my_factorial(a) * pow(d, MOD-2, MOD)
	return ret % MOD


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

if Z == 0:
	ans = comb(Y, Y-W) * X * my_factorial(X+Y-W-1)
else:
	ans = comb(X, X-Z) * Y * my_factorial(X+Y-Z-1)
print(ans % MOD)
0