結果
| 問題 |
No.1897 Sum of 2nd Max
|
| コンテスト | |
| ユーザー |
tamato
|
| 提出日時 | 2022-04-08 21:59:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 520 ms / 2,000 ms |
| コード長 | 410 bytes |
| コンパイル時間 | 357 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 68,096 KB |
| 最終ジャッジ日時 | 2024-11-28 12:40:28 |
| 合計ジャッジ時間 | 8,545 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
mod = 998244353
def main():
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
ans = 0
for x in range(1, K+1):
ans += ((x * N * (K - x))%mod * (pow(x, N - 1, mod) - pow(x - 1, N - 1, mod)))%mod
ans += (x * (pow(x, N, mod) - pow(x-1, N, mod) - N * pow(x-1, N-1, mod))%mod)%mod
ans %= mod
print(ans)
if __name__ == '__main__':
main()
tamato