結果

問題 No.2058 Binary String
ユーザー lloyzlloyz
提出日時 2023-08-08 00:02:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 66,900 KB
最終ジャッジ日時 2024-04-25 18:10:19
合計ジャッジ時間 3,617 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,024 KB
testcase_01 AC 36 ms
53,340 KB
testcase_02 AC 65 ms
65,088 KB
testcase_03 AC 36 ms
52,072 KB
testcase_04 AC 35 ms
53,164 KB
testcase_05 AC 36 ms
52,592 KB
testcase_06 AC 50 ms
62,892 KB
testcase_07 AC 136 ms
65,952 KB
testcase_08 AC 61 ms
62,760 KB
testcase_09 AC 143 ms
66,020 KB
testcase_10 AC 83 ms
65,392 KB
testcase_11 AC 65 ms
63,360 KB
testcase_12 AC 96 ms
66,900 KB
testcase_13 AC 85 ms
64,908 KB
testcase_14 AC 76 ms
65,052 KB
testcase_15 AC 75 ms
64,552 KB
testcase_16 AC 73 ms
64,024 KB
testcase_17 AC 84 ms
64,160 KB
testcase_18 AC 49 ms
62,512 KB
testcase_19 AC 144 ms
66,152 KB
testcase_20 AC 130 ms
66,344 KB
testcase_21 AC 141 ms
66,860 KB
testcase_22 AC 134 ms
66,460 KB
testcase_23 AC 152 ms
66,048 KB
testcase_24 AC 142 ms
66,372 KB
testcase_25 AC 155 ms
65,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fact = [1] * n
inv = [1] * n
finv = [1] * n
for i in range(2, n):
    fact[i] = fact[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod
def comb(x, y):
    return fact[x] * finv[y] % mod * finv[x - y] % mod

ans = 0
for i in range(1, n):
    ans += comb(n - 1, i) * pow(i, k, mod) % mod
    ans %= mod
print(ans)
0