-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6098.py
42 lines (36 loc) ยท 1.09 KB
/
6098.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ์ค๋ฅธ์ชฝ์ผ๋ก ์์ง์ด๋ค๊ฐ ๋ฒฝ์ธ ๊ฒฝ์ฐ๋ ์๋๋ก ์์ง์ธ๋ค
# ์ค๋ฅธ์ชฝ์ ๊ธธ์ด ์์ผ๋ฉด ๋ค์ ์ค๋ฅธ์ชฝ์ผ๋ก ์ด๋ํ๋ค
# ์ฆ ๋จน์ด๋ฅผ ์ฐพ๊ฑฐ๋ ์์ง์ผ ์ ์์ ๋ ๊น์ง ์ค๋ฅธ์ชฝ ํน์ ์๋๋ก ์ด๋ํ๋ค
# 0์ด ๊ฐ ์ ์๋ ๊ณณ, 1์ด ๋ฒฝ ๋๋ ์ฅ์ ๋ฌผ, 2๊ฐ ๋จน์ด ์์น, ๋งจ ์๋ ๊ฐ์ฅ ์ค๋ฅธ์ชฝ ์์น ์ข
์ , ์ด๋ ๊ฒฝ๋ก๋ 9๋ก ํ์
map = [list(map(int, input().split())) for _ in range(10)]
x = 1
y = 1
stop = False
while(not stop):
# Marking
if(x == 8 and y == 8):
map[x][y] = 9
stop = True
if(map[x][y] == 0):
map[x][y] = 9
if(map[x][y] == 2):
map[x][y] = 9
stop = True
# Move
if(map[x][y+1] == 0):
# ์ฐ์ธก ์ด๋์ด ๊ฐ๋ฅํ ๊ฒฝ์ฐ
y += 1
elif(map[x][y+1] == 2):
y += 1
else:
# ์ฐ์ธก ์ด๋์ด ๋ถ๊ฐ๋ฅํ ๊ฒฝ์ฐ
if(map[x+1][y] == 0):
x += 1
elif(map[x+1][y] == 2):
x += 1
else:
stop = True
for row in range(10):
for col in range(10):
print(map[row][col], end=' ')
print()