結果

問題 No.1897 Sum of 2nd Max
ユーザー KudeKude
提出日時 2022-04-08 21:56:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 199 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 77,060 KB
最終ジャッジ日時 2023-08-19 00:32:56
合計ジャッジ時間 7,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,116 KB
testcase_01 AC 62 ms
71,424 KB
testcase_02 AC 63 ms
71,560 KB
testcase_03 AC 294 ms
76,900 KB
testcase_04 AC 265 ms
77,060 KB
testcase_05 AC 178 ms
76,412 KB
testcase_06 AC 175 ms
76,180 KB
testcase_07 AC 221 ms
76,332 KB
testcase_08 AC 187 ms
76,412 KB
testcase_09 AC 304 ms
76,740 KB
testcase_10 AC 289 ms
76,768 KB
testcase_11 AC 296 ms
76,916 KB
testcase_12 AC 294 ms
76,740 KB
testcase_13 AC 296 ms
76,852 KB
testcase_14 AC 113 ms
76,072 KB
testcase_15 AC 115 ms
76,220 KB
testcase_16 AC 153 ms
76,136 KB
testcase_17 AC 128 ms
76,232 KB
testcase_18 AC 141 ms
76,224 KB
testcase_19 AC 64 ms
71,120 KB
testcase_20 AC 64 ms
71,276 KB
testcase_21 AC 63 ms
71,116 KB
testcase_22 AC 62 ms
71,628 KB
testcase_23 AC 61 ms
71,568 KB
testcase_24 AC 61 ms
71,392 KB
testcase_25 AC 64 ms
71,428 KB
testcase_26 AC 62 ms
71,444 KB
testcase_27 AC 61 ms
71,256 KB
testcase_28 AC 62 ms
71,276 KB
testcase_29 AC 63 ms
71,276 KB
testcase_30 AC 296 ms
76,908 KB
testcase_31 AC 318 ms
76,764 KB
testcase_32 AC 251 ms
76,476 KB
testcase_33 AC 358 ms
77,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353

n, k = map(int, input().split())
ans = 0
for x in range(1, k + 1):
    ans += pow(k, n, mod) - pow(x - 1, n, mod) - pow(x - 1, n - 1, mod) * (k - x + 1) * n
    ans %= mod
print(ans)
0