結果

問題 No.1552 Simple Dice Game
ユーザー tassei903tassei903
提出日時 2021-06-18 22:38:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 542 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 79,608 KB
最終ジャッジ日時 2023-09-04 23:49:10
合計ジャッジ時間 38,600 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,200 KB
testcase_01 AC 72 ms
71,320 KB
testcase_02 AC 73 ms
71,380 KB
testcase_03 TLE -
testcase_04 AC 71 ms
71,376 KB
testcase_05 AC 72 ms
71,376 KB
testcase_06 AC 71 ms
71,292 KB
testcase_07 AC 71 ms
71,292 KB
testcase_08 AC 72 ms
71,196 KB
testcase_09 WA -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")

n,m = na()
mod = 998244353

def g(x):
    return ((pow(x,n,mod)*(x+1)//2)%mod)*n%mod

def h(x):
    return ((pow(m-x+1,n,mod)*(m+x)//2)%mod)*n%mod
ans = 0
for k in range(1,m+1):
    #print(g(k)-g(k-1),h(k)-h(k+1))
    ans+=k*((g(k)-g(k-1)-h(k)+h(k+1))%mod)%mod
    ans%=mod
print(ans)
0