結果
問題 | No.2409 Strange Werewolves |
ユーザー | bug maker / ばぐめいかー@Python学習者 |
提出日時 | 2023-08-11 22:53:32 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 20,388 KB |
最終ジャッジ日時 | 2024-04-29 14:02:19 |
合計ジャッジ時間 | 3,683 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
16,128 KB |
testcase_01 | AC | 32 ms
10,624 KB |
testcase_02 | AC | 31 ms
10,752 KB |
testcase_03 | TLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
ソースコード
import sys input = lambda :sys.stdin.readline()[:-1] from math import sqrt, pi, exp, log, log10, sin, cos, tan, ceil, floor, perm, comb, gcd, modf, prod, inf, nan def main(): X, Y, Z, W = map(int, input().split()) if Z == 0: # 最後はXから1人 a = X # X人からX-1人を選ぶ b = comb(Y, W) % 998244353 # Y人からY-W人を選ぶ n = X + Y - W - 1 # X-1, Y-W 人を合わせた順列 ans = a * b * perm(n, n) % 998244353 elif W == 0: a = comb(X, Z) % 998244353 b = Y n = X + Y - Z - 1 # X-Z, Y-1 人を合わせた順列 # print(a,b,n) ans = a * b * perm(n, n) % 998244353 print(ans) if __name__ == '__main__': main()