[SWEA] Ladder1

Date:

[SWEA] Ladder1

Problem URL : Ladder1

for tc in range(1, 11):
    tc = int(input())
    arr = [list(map(int, input().split())) for _ in range(100)]
    idx = arr[99].index(2)
    for i in range(99,-1,-1):
        if idx > 0 and arr[i][idx - 1] == 1:
            while idx > 0 and arr[i][idx - 1] > 0:
                idx -= 1
        elif idx < 99 and arr[i][idx + 1] == 1:
            while idx < 99 and arr[i][idx + 1] > 0:
                idx += 1
    print('#{} {}'.format(tc, idx))

댓글