結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー とりゐとりゐ
提出日時 2022-11-25 21:25:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 75,880 KB
最終ジャッジ日時 2024-04-10 02:33:58
合計ジャッジ時間 2,628 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,132 KB
testcase_01 AC 38 ms
51,632 KB
testcase_02 AC 34 ms
52,920 KB
testcase_03 AC 34 ms
52,020 KB
testcase_04 AC 34 ms
51,628 KB
testcase_05 AC 33 ms
52,484 KB
testcase_06 AC 34 ms
53,124 KB
testcase_07 AC 34 ms
52,216 KB
testcase_08 AC 34 ms
53,728 KB
testcase_09 AC 35 ms
52,452 KB
testcase_10 AC 35 ms
52,316 KB
testcase_11 AC 35 ms
52,860 KB
testcase_12 AC 36 ms
57,916 KB
testcase_13 AC 37 ms
58,716 KB
testcase_14 AC 37 ms
58,900 KB
testcase_15 AC 40 ms
58,912 KB
testcase_16 AC 37 ms
58,548 KB
testcase_17 AC 42 ms
63,032 KB
testcase_18 AC 42 ms
65,436 KB
testcase_19 AC 45 ms
66,756 KB
testcase_20 AC 34 ms
52,628 KB
testcase_21 AC 44 ms
66,592 KB
testcase_22 AC 34 ms
53,292 KB
testcase_23 AC 44 ms
66,440 KB
testcase_24 AC 38 ms
58,588 KB
testcase_25 AC 44 ms
66,144 KB
testcase_26 AC 37 ms
58,972 KB
testcase_27 AC 69 ms
75,220 KB
testcase_28 AC 35 ms
52,472 KB
testcase_29 AC 67 ms
75,880 KB
testcase_30 AC 33 ms
53,500 KB
testcase_31 AC 32 ms
51,876 KB
testcase_32 AC 32 ms
53,232 KB
testcase_33 AC 34 ms
53,028 KB
testcase_34 AC 33 ms
52,996 KB
testcase_35 AC 33 ms
52,856 KB
testcase_36 AC 32 ms
52,312 KB
testcase_37 AC 33 ms
52,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

n=int(input())
m=int(input())
#n=10**18
#m=10**5
def fpow(x,k):
  res=1
  while k:
    if k&1:
      res=res*x%mod
    x=x*x%mod
    k>>=1
  return res

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

print(ans)
0