結果

問題 No.1897 Sum of 2nd Max
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-04-08 22:41:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 80,764 KB
最終ジャッジ日時 2023-08-19 01:08:56
合計ジャッジ時間 8,695 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,356 KB
testcase_01 AC 78 ms
71,156 KB
testcase_02 AC 82 ms
71,312 KB
testcase_03 AC 348 ms
80,424 KB
testcase_04 AC 327 ms
80,648 KB
testcase_05 AC 217 ms
77,744 KB
testcase_06 AC 218 ms
77,412 KB
testcase_07 AC 268 ms
80,764 KB
testcase_08 AC 227 ms
78,148 KB
testcase_09 AC 371 ms
80,312 KB
testcase_10 AC 349 ms
80,344 KB
testcase_11 AC 358 ms
80,284 KB
testcase_12 AC 353 ms
80,288 KB
testcase_13 AC 362 ms
80,316 KB
testcase_14 AC 147 ms
77,748 KB
testcase_15 AC 147 ms
77,896 KB
testcase_16 AC 181 ms
77,820 KB
testcase_17 AC 162 ms
77,852 KB
testcase_18 AC 177 ms
77,932 KB
testcase_19 AC 73 ms
71,500 KB
testcase_20 AC 71 ms
71,396 KB
testcase_21 AC 74 ms
71,440 KB
testcase_22 AC 72 ms
71,268 KB
testcase_23 AC 74 ms
71,444 KB
testcase_24 AC 75 ms
71,308 KB
testcase_25 AC 71 ms
71,304 KB
testcase_26 AC 72 ms
71,356 KB
testcase_27 AC 73 ms
71,312 KB
testcase_28 AC 81 ms
71,264 KB
testcase_29 AC 85 ms
71,336 KB
testcase_30 AC 353 ms
80,252 KB
testcase_31 AC 378 ms
80,496 KB
testcase_32 AC 303 ms
78,404 KB
testcase_33 AC 421 ms
80,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


mod=998244353
n,k=map(int,input().split())
f=[0]*(k+2)
for x in range(1,k+1):
    f[x]=pow((x-1+k-x+1),n,mod)-pow(x-1,n,mod)-n*(k-x+1)*pow(x-1,n-1,mod)
    f[x]%=mod

ans=0
for x in range(1,k+1):
    ans+=x*(f[x]-f[x+1])
    ans%=mod
print(ans)
0