結果

問題 No.1897 Sum of 2nd Max
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-04-08 23:03:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 585 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 77,044 KB
最終ジャッジ日時 2023-08-19 01:36:42
合計ジャッジ時間 10,474 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,360 KB
testcase_01 AC 68 ms
71,136 KB
testcase_02 AC 69 ms
71,312 KB
testcase_03 AC 509 ms
76,592 KB
testcase_04 AC 521 ms
77,044 KB
testcase_05 AC 287 ms
76,980 KB
testcase_06 AC 290 ms
76,784 KB
testcase_07 AC 356 ms
76,768 KB
testcase_08 AC 298 ms
76,976 KB
testcase_09 AC 503 ms
76,872 KB
testcase_10 AC 476 ms
76,992 KB
testcase_11 AC 474 ms
76,900 KB
testcase_12 AC 489 ms
76,916 KB
testcase_13 AC 498 ms
76,972 KB
testcase_14 AC 174 ms
76,680 KB
testcase_15 AC 178 ms
76,772 KB
testcase_16 AC 241 ms
76,764 KB
testcase_17 AC 210 ms
76,812 KB
testcase_18 AC 233 ms
76,892 KB
testcase_19 AC 69 ms
71,336 KB
testcase_20 AC 68 ms
71,236 KB
testcase_21 AC 68 ms
71,312 KB
testcase_22 AC 68 ms
71,316 KB
testcase_23 AC 69 ms
71,212 KB
testcase_24 AC 69 ms
71,268 KB
testcase_25 AC 69 ms
71,272 KB
testcase_26 AC 69 ms
71,524 KB
testcase_27 AC 70 ms
71,256 KB
testcase_28 AC 69 ms
71,116 KB
testcase_29 AC 67 ms
71,372 KB
testcase_30 AC 499 ms
76,628 KB
testcase_31 AC 519 ms
76,648 KB
testcase_32 AC 419 ms
76,984 KB
testcase_33 AC 585 ms
76,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
mod = 998244353
ans = 0
last = 0
for i in range(1,k+1)[::-1]:


    ans += i*n*(k-i)*(pow(i,n-1,mod)-pow(i-1,n-1,mod))%mod
    # print(ans,i)
    ans += i*(pow(i,n,mod)-pow(i-1,n,mod)-n*pow(i-1,n-1,mod))%mod
    # print(ans,i)
    ans %= mod
print(ans)
0