結果

問題 No.2058 Binary String
ユーザー flygonflygon
提出日時 2022-09-19 16:57:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,744 KB
実行使用メモリ 117,872 KB
最終ジャッジ日時 2023-08-23 18:58:42
合計ジャッジ時間 6,127 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,328 KB
testcase_01 AC 70 ms
71,260 KB
testcase_02 AC 140 ms
117,820 KB
testcase_03 AC 76 ms
70,964 KB
testcase_04 AC 71 ms
71,132 KB
testcase_05 AC 72 ms
71,252 KB
testcase_06 AC 83 ms
76,100 KB
testcase_07 AC 198 ms
112,824 KB
testcase_08 AC 99 ms
80,320 KB
testcase_09 AC 209 ms
113,132 KB
testcase_10 AC 126 ms
89,604 KB
testcase_11 AC 108 ms
83,216 KB
testcase_12 AC 151 ms
99,388 KB
testcase_13 AC 133 ms
96,544 KB
testcase_14 AC 116 ms
86,144 KB
testcase_15 AC 115 ms
86,016 KB
testcase_16 AC 119 ms
87,664 KB
testcase_17 AC 130 ms
91,656 KB
testcase_18 AC 83 ms
76,192 KB
testcase_19 AC 217 ms
117,668 KB
testcase_20 AC 192 ms
108,428 KB
testcase_21 AC 210 ms
117,796 KB
testcase_22 AC 206 ms
117,600 KB
testcase_23 AC 221 ms
117,872 KB
testcase_24 AC 210 ms
117,716 KB
testcase_25 AC 224 ms
117,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
mod = 998244353

#nCk
def com(n,mod):
  fact = [1,1]
  factinv = [1,1]
  inv = [0,1]
  for i in range(2,n+1):
    fact.append((fact[-1]*i)%mod)
    inv.append((-inv[mod%i]*(mod//i))%mod)
    factinv.append((factinv[-1]*inv[-1])%mod)
  return fact, factinv

f,fi = com(n+10,mod)
def ncr(n,r):
  return f[n]*fi[r]%mod*fi[n-r]%mod
ans = 0
for i in range(n):
  tmp = ncr(n-1, i)
  ans += tmp * pow(i,k,mod)%mod
  ans %= mod
print(ans)
0