結果

問題 No.1897 Sum of 2nd Max
ユーザー ニックネームニックネーム
提出日時 2022-04-08 23:06:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 544 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 77,140 KB
最終ジャッジ日時 2023-08-19 01:40:11
合計ジャッジ時間 9,664 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,360 KB
testcase_01 AC 60 ms
71,260 KB
testcase_02 AC 59 ms
71,624 KB
testcase_03 AC 458 ms
77,000 KB
testcase_04 AC 469 ms
76,928 KB
testcase_05 AC 258 ms
76,708 KB
testcase_06 AC 259 ms
76,772 KB
testcase_07 AC 320 ms
76,904 KB
testcase_08 AC 274 ms
77,008 KB
testcase_09 AC 463 ms
77,000 KB
testcase_10 AC 432 ms
76,980 KB
testcase_11 AC 447 ms
76,820 KB
testcase_12 AC 445 ms
76,880 KB
testcase_13 AC 451 ms
76,960 KB
testcase_14 AC 155 ms
76,816 KB
testcase_15 AC 155 ms
76,680 KB
testcase_16 AC 217 ms
76,852 KB
testcase_17 AC 188 ms
76,760 KB
testcase_18 AC 221 ms
76,820 KB
testcase_19 AC 60 ms
71,548 KB
testcase_20 AC 59 ms
71,520 KB
testcase_21 AC 58 ms
71,236 KB
testcase_22 AC 61 ms
71,604 KB
testcase_23 AC 60 ms
71,476 KB
testcase_24 AC 60 ms
71,312 KB
testcase_25 AC 60 ms
71,612 KB
testcase_26 AC 60 ms
71,248 KB
testcase_27 AC 60 ms
71,232 KB
testcase_28 AC 60 ms
71,268 KB
testcase_29 AC 68 ms
71,116 KB
testcase_30 AC 457 ms
76,936 KB
testcase_31 AC 475 ms
76,740 KB
testcase_32 AC 381 ms
76,988 KB
testcase_33 AC 544 ms
77,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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