結果
| 問題 | 
                            No.1552 Simple Dice Game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nok0
                         | 
                    
| 提出日時 | 2021-06-18 20:15:39 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 868 ms / 2,500 ms | 
| コード長 | 403 bytes | 
| コンパイル時間 | 234 ms | 
| コンパイル使用メモリ | 82,056 KB | 
| 実行使用メモリ | 100,392 KB | 
| 最終ジャッジ日時 | 2024-06-22 19:37:38 | 
| 合計ジャッジ時間 | 11,556 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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