結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー qibqib
提出日時 2023-02-02 19:57:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 247 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 76,392 KB
最終ジャッジ日時 2023-09-15 01:07:22
合計ジャッジ時間 5,171 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,324 KB
testcase_01 AC 71 ms
71,576 KB
testcase_02 AC 72 ms
71,148 KB
testcase_03 WA -
testcase_04 AC 69 ms
71,472 KB
testcase_05 AC 67 ms
71,616 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 69 ms
71,652 KB
testcase_09 AC 69 ms
71,136 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 69 ms
71,340 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 67 ms
71,504 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 71 ms
71,248 KB
testcase_29 WA -
testcase_30 AC 72 ms
71,340 KB
testcase_31 AC 69 ms
71,276 KB
testcase_32 AC 69 ms
71,384 KB
testcase_33 WA -
testcase_34 AC 69 ms
71,340 KB
testcase_35 AC 71 ms
71,356 KB
testcase_36 AC 71 ms
71,404 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
m = int(input())

if m > n:
  print("0")
  exit()

ans = pow(2, n, MOD)
cnt = 1
for r in range(m):
  ans = (ans - cnt) % MOD
  cnt = (cnt * (n + 1 - r)) % MOD
  cnt = (cnt * pow(r, MOD - 2, MOD)) % MOD

print(ans)
0