結果

問題 No.2807 Have Another Go (Easy)
ユーザー detteiuudetteiuu
提出日時 2024-07-12 22:12:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 213 ms / 3,000 ms
コード長 677 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 104,064 KB
最終ジャッジ日時 2024-07-12 22:12:10
合計ジャッジ時間 7,216 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,072 KB
testcase_01 AC 181 ms
103,176 KB
testcase_02 AC 141 ms
92,900 KB
testcase_03 AC 148 ms
90,188 KB
testcase_04 AC 103 ms
87,708 KB
testcase_05 AC 148 ms
97,092 KB
testcase_06 AC 152 ms
96,584 KB
testcase_07 AC 72 ms
74,928 KB
testcase_08 AC 99 ms
83,300 KB
testcase_09 AC 106 ms
84,780 KB
testcase_10 AC 113 ms
89,720 KB
testcase_11 AC 180 ms
103,760 KB
testcase_12 AC 201 ms
103,708 KB
testcase_13 AC 179 ms
103,776 KB
testcase_14 AC 180 ms
103,828 KB
testcase_15 AC 177 ms
104,064 KB
testcase_16 AC 180 ms
103,744 KB
testcase_17 AC 179 ms
103,896 KB
testcase_18 AC 213 ms
103,936 KB
testcase_19 AC 184 ms
103,976 KB
testcase_20 AC 179 ms
103,684 KB
testcase_21 AC 179 ms
103,692 KB
testcase_22 AC 178 ms
104,048 KB
testcase_23 AC 179 ms
103,748 KB
testcase_24 AC 180 ms
103,968 KB
testcase_25 AC 180 ms
103,760 KB
testcase_26 AC 181 ms
103,628 KB
testcase_27 AC 180 ms
103,932 KB
testcase_28 AC 183 ms
103,824 KB
testcase_29 AC 182 ms
103,760 KB
testcase_30 AC 184 ms
104,056 KB
testcase_31 AC 51 ms
64,280 KB
testcase_32 AC 50 ms
63,296 KB
testcase_33 AC 51 ms
64,496 KB
testcase_34 AC 49 ms
62,976 KB
testcase_35 AC 52 ms
63,996 KB
testcase_36 AC 48 ms
61,160 KB
testcase_37 AC 39 ms
54,260 KB
testcase_38 AC 54 ms
65,420 KB
testcase_39 AC 39 ms
54,112 KB
testcase_40 AC 67 ms
64,756 KB
testcase_41 AC 53 ms
66,748 KB
testcase_42 AC 53 ms
66,504 KB
testcase_43 AC 53 ms
65,260 KB
testcase_44 AC 54 ms
64,492 KB
testcase_45 AC 54 ms
64,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = map(int, input().split())
C = list(map(int, input().split()))

MOD = 998244353
dp0 = [0]*(N+1)
dp0[0] = 1
for i in range(N):
    for j in range(1, 7):
        if i+j <= N:
            dp0[i+j] += dp0[i]
            dp0[i+j] %= MOD
cntN = dp0[-1]

dp = [0]*(N*M+1)
dp[0] = 1
dp2 = [0]*(N*M+1)
for i in range(N*M):
    for j in range(1, 7):
        dp[min(i+j, N*M)] += dp[i]
        dp[min(i+j, N*M)] %= MOD
        dp2[min(i+j, N*M)] += dp[i]*(7-j)
        dp2[min(i+j, N*M)] %= MOD
dp2 = dp2[::-1]

for i in range(K):
    top = dp[C[i]]*dp2[C[i]]%MOD
    bottom = dp[C[i]+N]*dp2[C[i]+N]%MOD
    minus = cntN*dp[C[i]]*dp2[C[i]+N]%MOD
    print((top+bottom-minus)%MOD)
0