結果

問題 No.1897 Sum of 2nd Max
ユーザー とりゐとりゐ
提出日時 2022-04-08 21:46:24
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 571 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 77,012 KB
最終ジャッジ日時 2023-08-19 00:24:25
合計ジャッジ時間 10,448 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,396 KB
testcase_01 AC 69 ms
71,268 KB
testcase_02 AC 70 ms
71,444 KB
testcase_03 AC 490 ms
76,836 KB
testcase_04 AC 501 ms
76,876 KB
testcase_05 AC 276 ms
76,328 KB
testcase_06 AC 283 ms
76,312 KB
testcase_07 AC 341 ms
76,396 KB
testcase_08 AC 292 ms
76,440 KB
testcase_09 AC 476 ms
77,012 KB
testcase_10 AC 452 ms
76,720 KB
testcase_11 AC 461 ms
76,952 KB
testcase_12 AC 462 ms
76,648 KB
testcase_13 AC 465 ms
76,916 KB
testcase_14 AC 162 ms
75,860 KB
testcase_15 AC 160 ms
76,208 KB
testcase_16 AC 221 ms
75,852 KB
testcase_17 AC 198 ms
76,004 KB
testcase_18 AC 212 ms
75,884 KB
testcase_19 AC 69 ms
71,488 KB
testcase_20 AC 69 ms
71,196 KB
testcase_21 AC 70 ms
71,396 KB
testcase_22 AC 69 ms
71,032 KB
testcase_23 AC 68 ms
71,332 KB
testcase_24 AC 68 ms
71,192 KB
testcase_25 AC 67 ms
71,292 KB
testcase_26 AC 68 ms
71,340 KB
testcase_27 AC 70 ms
71,380 KB
testcase_28 AC 67 ms
71,380 KB
testcase_29 AC 69 ms
71,216 KB
testcase_30 AC 480 ms
76,828 KB
testcase_31 AC 503 ms
76,756 KB
testcase_32 AC 393 ms
76,252 KB
testcase_33 AC 571 ms
76,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for x in range(1,k+1):
  tmp=pow(x,n,mod)-n*pow(x-1,n-1,mod)-pow(x-1,n,mod)
  ans+=x*tmp%mod
  ans%=mod

print(ans)
0