結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー とりゐとりゐ
提出日時 2022-11-25 21:23:46
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 281 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 844,104 KB
最終ジャッジ日時 2024-04-10 02:32:02
合計ジャッジ時間 2,852 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,556 KB
testcase_01 AC 37 ms
52,288 KB
testcase_02 AC 36 ms
52,312 KB
testcase_03 AC 34 ms
53,724 KB
testcase_04 AC 33 ms
51,888 KB
testcase_05 AC 34 ms
53,000 KB
testcase_06 AC 33 ms
52,396 KB
testcase_07 AC 34 ms
52,664 KB
testcase_08 AC 34 ms
52,472 KB
testcase_09 AC 34 ms
52,856 KB
testcase_10 AC 33 ms
53,492 KB
testcase_11 AC 32 ms
52,888 KB
testcase_12 AC 35 ms
59,376 KB
testcase_13 AC 36 ms
58,784 KB
testcase_14 AC 40 ms
59,744 KB
testcase_15 AC 40 ms
59,388 KB
testcase_16 AC 39 ms
58,484 KB
testcase_17 AC 42 ms
62,348 KB
testcase_18 AC 47 ms
66,508 KB
testcase_19 AC 46 ms
66,444 KB
testcase_20 AC 39 ms
53,876 KB
testcase_21 MLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

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

def fpow(x,k):
  res=1
  while k:
    if k&1:
      res=res*x%mod
    x=x*x%mod
    k>>=1
  return res

ans=pow(2,n)-1
tmp=1
for i in range(1,m):
  tmp*=n+1-i
  tmp%=mod
  tmp*=fpow(i,mod-2)
  tmp%=mod
  ans-=tmp
  ans%=mod

print(ans)
0