1210.[S/W 문제해결 기본] 2일차 - Ladder1
풀이
T = 10
answer = []
for tc in range(1, T + 1):
nothing = int(input())
ladder = []
for _ in range(100):
ladder.append(list(map(int, input().split())))
result = 0
for start in range(100):
if ladder[0][start] == 1:
i = 0
j = start
while i < 100:
if j-1 >= 0 and ladder[i][j-1] == 1:
while j-1 >= 0 and ladder[i][j-1] == 1:
j -= 1
elif j+1 < 100 and ladder[i][j+1] == 1:
while j+1 < 100 and ladder[i][j+1] == 1:
j += 1
i += 1
if ladder[i-1][j] == 2:
result = start
answer.append(result)
for tc in range(1, T+1):
print(f'#{tc} {answer[tc-1]}')