結果

問題 No.1897 Sum of 2nd Max
ユーザー first_vilfirst_vil
提出日時 2022-04-08 21:31:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 632 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 77,032 KB
最終ジャッジ日時 2023-08-19 00:12:31
合計ジャッジ時間 11,414 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,328 KB
testcase_01 AC 73 ms
71,420 KB
testcase_02 AC 71 ms
71,492 KB
testcase_03 AC 531 ms
77,012 KB
testcase_04 AC 547 ms
76,828 KB
testcase_05 AC 309 ms
76,944 KB
testcase_06 AC 311 ms
76,628 KB
testcase_07 AC 384 ms
76,932 KB
testcase_08 AC 333 ms
76,972 KB
testcase_09 AC 541 ms
76,596 KB
testcase_10 AC 507 ms
76,820 KB
testcase_11 AC 519 ms
77,032 KB
testcase_12 AC 516 ms
76,844 KB
testcase_13 AC 526 ms
76,720 KB
testcase_14 AC 193 ms
76,816 KB
testcase_15 AC 190 ms
76,620 KB
testcase_16 AC 247 ms
76,372 KB
testcase_17 AC 224 ms
76,592 KB
testcase_18 AC 244 ms
76,904 KB
testcase_19 AC 73 ms
71,240 KB
testcase_20 AC 73 ms
71,240 KB
testcase_21 AC 72 ms
71,252 KB
testcase_22 AC 73 ms
71,000 KB
testcase_23 AC 74 ms
71,084 KB
testcase_24 AC 74 ms
71,184 KB
testcase_25 AC 73 ms
71,368 KB
testcase_26 AC 74 ms
71,280 KB
testcase_27 AC 74 ms
71,320 KB
testcase_28 AC 76 ms
71,268 KB
testcase_29 AC 78 ms
71,336 KB
testcase_30 AC 538 ms
76,684 KB
testcase_31 AC 559 ms
76,852 KB
testcase_32 AC 452 ms
76,652 KB
testcase_33 AC 632 ms
76,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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