結果

問題 No.2430 Damage Zone
ユーザー 310icecrystal310icecrystal
提出日時 2023-08-18 21:45:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 475 ms / 2,000 ms
コード長 849 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 116,432 KB
最終ジャッジ日時 2024-05-06 03:43:43
合計ジャッジ時間 7,078 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 378 ms
99,256 KB
testcase_01 AC 148 ms
83,332 KB
testcase_02 AC 475 ms
115,680 KB
testcase_03 AC 54 ms
63,872 KB
testcase_04 AC 63 ms
66,304 KB
testcase_05 AC 77 ms
73,216 KB
testcase_06 AC 36 ms
51,712 KB
testcase_07 AC 36 ms
51,840 KB
testcase_08 AC 37 ms
51,840 KB
testcase_09 AC 36 ms
51,840 KB
testcase_10 AC 38 ms
52,352 KB
testcase_11 AC 110 ms
76,868 KB
testcase_12 AC 98 ms
76,916 KB
testcase_13 AC 50 ms
61,824 KB
testcase_14 AC 453 ms
115,732 KB
testcase_15 AC 446 ms
116,432 KB
testcase_16 AC 455 ms
116,012 KB
testcase_17 AC 262 ms
84,636 KB
testcase_18 AC 115 ms
77,940 KB
testcase_19 AC 50 ms
60,672 KB
testcase_20 AC 316 ms
91,452 KB
testcase_21 AC 89 ms
76,800 KB
testcase_22 AC 80 ms
73,728 KB
testcase_23 AC 75 ms
72,960 KB
testcase_24 AC 72 ms
71,552 KB
testcase_25 AC 194 ms
89,464 KB
testcase_26 AC 200 ms
91,732 KB
testcase_27 AC 182 ms
87,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,K = map(int,input().split())
S = [input() for _ in range(H)]
MOD = 998244353

#dp[h][w][k]=マス(h,w)に体力の減少kで行くことができる移動経路の数
dp = [[[0]*K for _ in range(W)] for _ in range(H)]
dp[0][0][0] = 1
for h in range(H):
    for w in range(W):
        for k in range(K):
            if h+1 <= H-1:
                if S[h+1][w] == ".":
                    dp[h+1][w][k] += dp[h][w][k]
                elif S[h+1][w] == "o" and k <= K-2:
                    dp[h+1][w][k+1] += dp[h][w][k]
            if w+1 <= W-1:
                if S[h][w+1] == ".":
                    dp[h][w+1][k] += dp[h][w][k]
                elif S[h][w+1] == "o" and k <= K-2:
                    dp[h][w+1][k+1] += dp[h][w][k]
            dp[h][w][k] %= MOD
ans = 0
for k in range(K):
    ans += dp[H-1][W-1][k]
    ans %= MOD
print(ans)
0