結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー ninja-kidninja-kid
提出日時 2022-11-28 16:08:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 318 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,636 KB
実行使用メモリ 61,684 KB
最終ジャッジ日時 2024-04-15 15:39:30
合計ジャッジ時間 3,663 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,160 KB
testcase_01 AC 42 ms
52,300 KB
testcase_02 AC 41 ms
52,428 KB
testcase_03 AC 46 ms
52,600 KB
testcase_04 AC 42 ms
52,364 KB
testcase_05 AC 43 ms
52,112 KB
testcase_06 AC 47 ms
51,756 KB
testcase_07 AC 45 ms
52,032 KB
testcase_08 AC 42 ms
52,948 KB
testcase_09 AC 43 ms
53,064 KB
testcase_10 AC 41 ms
52,756 KB
testcase_11 AC 43 ms
53,404 KB
testcase_12 AC 42 ms
52,072 KB
testcase_13 AC 42 ms
52,852 KB
testcase_14 AC 44 ms
52,400 KB
testcase_15 AC 41 ms
53,888 KB
testcase_16 AC 41 ms
52,576 KB
testcase_17 AC 51 ms
60,208 KB
testcase_18 AC 59 ms
60,556 KB
testcase_19 AC 61 ms
60,752 KB
testcase_20 AC 45 ms
52,948 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = int(input())
if N < M:
  print(0)
  exit()
if N == M:
  print(1)
  exit()
mod = 998244353

N %= mod
base = pow(2, N, mod)
val = 0
fact = 1
inv = 1
for i in range(M):
  val += fact * pow(inv, mod - 2, mod) % mod
  fact = fact * (N - i) % mod
  inv = inv * (i + 1) % mod
print((base - val) % mod)
  
0