結果

問題 No.2206 Popcount Sum 2
ユーザー とりゐとりゐ
提出日時 2023-01-30 14:43:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 536 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 89,956 KB
最終ジャッジ日時 2023-09-15 10:59:51
合計ジャッジ時間 8,607 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
83,024 KB
testcase_01 AC 92 ms
82,956 KB
testcase_02 AC 548 ms
84,432 KB
testcase_03 AC 556 ms
84,056 KB
testcase_04 AC 560 ms
84,284 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

M=(10**5)*3+1 
fac=[1]*M
ninv=[1]*M
finv=[1]*M
for i in range(2,M):
  fac[i]=fac[i-1]*i%mod
  ninv[i]=(-(mod//i)*ninv[mod%i])%mod
  finv[i]=finv[i-1]*ninv[i]%mod

def binom(n,k):
  if n<0 or k<0:
    return 0
  if k>n:
    return 0
  return (fac[n]*finv[k]%mod)*finv[n-k]%mod

from sys import stdin
input=lambda :stdin.readline()[:-1]

def solve():
  n,m=map(int,input().split())
  ans=0
  for i in range(m):
    ans+=binom(n-1,i)
    ans%=mod
  ans*=pow(2,n)-1
  print(ans%mod)



for _ in range(int(input())):
  solve()
0