結果
| 問題 | No.2708 Jewel holder | 
| コンテスト | |
| ユーザー |  n_na | 
| 提出日時 | 2024-04-01 16:13:21 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 93 ms / 2,000 ms | 
| コード長 | 585 bytes | 
| コンパイル時間 | 200 ms | 
| コンパイル使用メモリ | 82,244 KB | 
| 実行使用メモリ | 76,096 KB | 
| 最終ジャッジ日時 | 2024-09-30 21:53:18 | 
| 合計ジャッジ時間 | 1,862 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
def rec(cy,cx,cc):
    if A[cy][cx] == "o":
        nc = cc + 1
    else:
        if cc == 0:
            return
        else:
            nc = cc - 1
    if cy == H-1 and cx == W-1:
        res[0] += 1
        return
        
    for i in range(2):
        ny,nx = cy +dy[i],cx+dx[i]
        if not (0 <= ny < H and 0 <= nx < W):
            continue
        if A[ny][nx] == "#":
            continue
        rec(ny,nx,nc)
        
H,W = map(int,input().split())
A = []
for _ in range(H):
    a = input()
    A.append(a)
dy = (0,1)
dx = (1,0)
res = [0]
rec(0,0,0)
print(res[0])
            
            
            
        