結果

問題 No.2113 Distance Sequence 1.5
ユーザー shotoyooshotoyoo
提出日時 2022-10-28 22:11:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 86,544 KB
実行使用メモリ 72,272 KB
最終ジャッジ日時 2023-09-20 05:11:07
合計ジャッジ時間 4,799 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,628 KB
testcase_01 AC 94 ms
71,852 KB
testcase_02 AC 96 ms
72,088 KB
testcase_03 AC 104 ms
71,908 KB
testcase_04 AC 95 ms
71,904 KB
testcase_05 AC 97 ms
71,776 KB
testcase_06 AC 97 ms
71,840 KB
testcase_07 AC 92 ms
71,844 KB
testcase_08 AC 96 ms
72,272 KB
testcase_09 AC 97 ms
71,852 KB
testcase_10 AC 96 ms
71,744 KB
testcase_11 AC 94 ms
72,144 KB
testcase_12 AC 96 ms
71,804 KB
testcase_13 AC 97 ms
71,852 KB
testcase_14 AC 95 ms
72,168 KB
testcase_15 AC 98 ms
71,900 KB
testcase_16 AC 98 ms
72,044 KB
testcase_17 AC 95 ms
72,156 KB
testcase_18 AC 95 ms
71,864 KB
testcase_19 AC 93 ms
72,048 KB
testcase_20 AC 95 ms
71,900 KB
testcase_21 AC 95 ms
71,872 KB
testcase_22 AC 94 ms
71,748 KB
testcase_23 AC 95 ms
72,000 KB
testcase_24 AC 96 ms
72,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input()); SI=lambda : [ord(c)-ord("a") for c in input()]
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

n,m,k = list(map(int, input().split()))
M = 998244353
if k<=m:
    ans = pow(k, 2*n, M) * (m-k+1) % M
    ans -= pow(k-1, 2*n, M) * (m-k) % M
else:
    ans = pow(m, 2*n, M)
print(ans%M)
0