結果

問題 No.1897 Sum of 2nd Max
ユーザー ニックネームニックネーム
提出日時 2022-04-08 23:06:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 626 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2024-05-06 08:49:41
合計ジャッジ時間 10,373 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,712 KB
testcase_01 AC 35 ms
51,712 KB
testcase_02 AC 36 ms
51,584 KB
testcase_03 AC 526 ms
75,776 KB
testcase_04 AC 540 ms
75,444 KB
testcase_05 AC 287 ms
75,264 KB
testcase_06 AC 288 ms
75,392 KB
testcase_07 AC 358 ms
75,520 KB
testcase_08 AC 304 ms
75,520 KB
testcase_09 AC 529 ms
75,752 KB
testcase_10 AC 496 ms
75,520 KB
testcase_11 AC 502 ms
75,904 KB
testcase_12 AC 510 ms
75,648 KB
testcase_13 AC 518 ms
75,520 KB
testcase_14 AC 163 ms
75,136 KB
testcase_15 AC 164 ms
75,136 KB
testcase_16 AC 237 ms
75,136 KB
testcase_17 AC 203 ms
75,264 KB
testcase_18 AC 229 ms
75,392 KB
testcase_19 AC 39 ms
51,584 KB
testcase_20 AC 37 ms
51,584 KB
testcase_21 AC 38 ms
51,584 KB
testcase_22 AC 38 ms
51,712 KB
testcase_23 AC 39 ms
51,968 KB
testcase_24 AC 39 ms
51,584 KB
testcase_25 AC 39 ms
51,712 KB
testcase_26 AC 39 ms
51,712 KB
testcase_27 AC 39 ms
51,584 KB
testcase_28 AC 40 ms
52,096 KB
testcase_29 AC 39 ms
51,456 KB
testcase_30 AC 526 ms
75,648 KB
testcase_31 AC 554 ms
75,576 KB
testcase_32 AC 426 ms
75,520 KB
testcase_33 AC 626 ms
75,520 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