๋ฌธ์
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14ABYKADACFAYh
ํ์ด
# 1210. [S/W ๋ฌธ์ ํด๊ฒฐ ๊ธฐ๋ณธ] 2์ผ์ฐจ - Ladder1 [D4]
for _ in range(1, 11):
tc = int(input())
graph = [list(map(int, input().split())) for _ in range(100)]
visited = [[0]*100 for _ in range(100)]
start = graph[99].index(2)
x, y = 99, start
while x != 0:
visited[x][y] = 1
if y - 1 >= 0 and graph[x][y-1] and visited[x][y-1] == 0:
y -= 1
continue
elif y + 1 < 100 and graph[x][y+1] and visited[x][y+1] == 0:
y += 1
continue
else:
x -= 1
answer = y
print("#{} {}".format(tc, answer))
'๐๏ธ Algorithm > โน๏ธ SW Expert Academy [SWEA]' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
โน๏ธ[SW Expert Academy] [D4] [1226] ๋ฏธ๋ก1 (0) | 2024.03.30 |
---|---|
โน๏ธ[SW Expert Academy] [Python] [D3] [1244] ์ต๋ ์๊ธ (1) | 2024.03.18 |
โน๏ธ[SW Expert Academy] [Python] [D4] [1249] ๋ณด๊ธ๋ก (0) | 2024.03.14 |
โน๏ธ[SW Expert Academy] [Python] [D2] [1859] ๋ฐฑ๋ง ์ฅ์ ํ๋ก์ ํธ (0) | 2024.03.13 |
โน๏ธ[SW Expert Academy] [Python] [D3] [1208] Flatten (0) | 2024.03.12 |