結果
| 問題 | No.1552 Simple Dice Game |
| コンテスト | |
| ユーザー |
nok0
|
| 提出日時 | 2021-06-18 20:15:39 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 367 ms / 2,500 ms |
| + 887µs | |
| コード長 | 403 bytes |
| 記録 | |
| コンパイル時間 | 232 ms |
| コンパイル使用メモリ | 96,240 KB |
| 実行使用メモリ | 120,064 KB |
| 最終ジャッジ日時 | 2026-07-27 08:44:31 |
| 合計ジャッジ時間 | 6,849 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
n, m = map(int, input().split())
res, mod = 0, 998244353
pow_table = []
for i in range(m + 1):
pow_table.append(pow(i, n, mod))
for r in range(1, m + 1):
res += (pow_table[r] - pow_table[r - 1]) * r
res %= mod
for l in range(1, m + 1):
res -= (pow_table[m - l + 1] - pow_table[m - l]) * l
res %= mod
res *= n
res %= mod
res *= m + 1
res %= mod
res *= 499122177
res %= mod
print(res)
nok0