結果

問題 No.2058 Binary String
ユーザー dachengzdachengz
提出日時 2022-11-16 08:51:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 81,204 KB
実行使用メモリ 76,384 KB
最終ジャッジ日時 2023-10-17 08:04:08
合計ジャッジ時間 4,052 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,100 KB
testcase_01 AC 37 ms
53,100 KB
testcase_02 AC 85 ms
76,384 KB
testcase_03 AC 36 ms
53,100 KB
testcase_04 AC 37 ms
53,100 KB
testcase_05 AC 37 ms
53,100 KB
testcase_06 AC 51 ms
61,600 KB
testcase_07 AC 148 ms
76,228 KB
testcase_08 AC 63 ms
65,952 KB
testcase_09 AC 157 ms
76,276 KB
testcase_10 AC 88 ms
73,404 KB
testcase_11 AC 69 ms
68,096 KB
testcase_12 AC 105 ms
75,672 KB
testcase_13 AC 94 ms
75,548 KB
testcase_14 AC 78 ms
70,240 KB
testcase_15 AC 77 ms
70,228 KB
testcase_16 AC 80 ms
72,360 KB
testcase_17 AC 94 ms
75,432 KB
testcase_18 AC 49 ms
61,596 KB
testcase_19 AC 157 ms
76,320 KB
testcase_20 AC 141 ms
76,012 KB
testcase_21 AC 158 ms
76,372 KB
testcase_22 AC 150 ms
76,376 KB
testcase_23 AC 164 ms
76,376 KB
testcase_24 AC 155 ms
76,376 KB
testcase_25 AC 168 ms
76,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())

mod = 998244353
inv = [1] * (N + 1)
for i in range(2, N + 1):
    inv[i] = mod - mod // i * inv[mod % i] % mod

ans = 0
c = 1
for i in range(N):
    ans += c * pow(i, K, mod)
    c = c * (N - i - 1) * inv[i + 1] % mod
ans %= mod
print(ans)
0