結果

問題 No.1897 Sum of 2nd Max
ユーザー siganaisiganai
提出日時 2022-04-09 18:43:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 658 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 2,000 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 79,936 KB
最終ジャッジ日時 2023-08-19 22:44:08
合計ジャッジ時間 14,915 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
78,668 KB
testcase_01 AC 146 ms
78,576 KB
testcase_02 AC 142 ms
78,628 KB
testcase_03 AC 554 ms
79,412 KB
testcase_04 AC 565 ms
79,732 KB
testcase_05 AC 357 ms
79,732 KB
testcase_06 AC 356 ms
79,696 KB
testcase_07 AC 417 ms
79,688 KB
testcase_08 AC 373 ms
79,720 KB
testcase_09 AC 568 ms
79,724 KB
testcase_10 AC 531 ms
79,724 KB
testcase_11 AC 545 ms
79,932 KB
testcase_12 AC 534 ms
79,832 KB
testcase_13 AC 547 ms
79,716 KB
testcase_14 AC 239 ms
79,348 KB
testcase_15 AC 236 ms
79,792 KB
testcase_16 AC 297 ms
79,680 KB
testcase_17 AC 272 ms
79,692 KB
testcase_18 AC 295 ms
79,632 KB
testcase_19 AC 145 ms
78,736 KB
testcase_20 AC 147 ms
78,644 KB
testcase_21 AC 145 ms
78,724 KB
testcase_22 AC 145 ms
78,584 KB
testcase_23 AC 145 ms
78,612 KB
testcase_24 AC 147 ms
78,608 KB
testcase_25 AC 144 ms
78,772 KB
testcase_26 AC 147 ms
78,580 KB
testcase_27 AC 147 ms
78,400 KB
testcase_28 AC 149 ms
78,840 KB
testcase_29 AC 149 ms
78,720 KB
testcase_30 AC 556 ms
79,936 KB
testcase_31 AC 584 ms
79,772 KB
testcase_32 AC 482 ms
79,572 KB
testcase_33 AC 658 ms
79,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
import heapq
import functools
mod=998244353

import sys
input=sys.stdin.readline

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