알고리즘/SWEA9 [swea][파이썬] 1206 .[S/W 문제해결 기본] 1일차 - View a에 리스트 저장한 후에 a로 조망이 확보 되는지 확인 한 후 확보되면 -1 하면서 확보되지 않을 때 까지 cnt 를 올려주는 방식으로 풀이했다. import sys sys.stdin = open('input.txt') for test in range(10): x = int(input()) lst = list(map(int, input().split())) total = 0 for lstIdx in range(2, x-2): cnt = 0 a = lst[lstIdx] while a > lst[lstIdx-1] and a > lst[lstIdx-2] and a > lst[lstIdx+1] and a > lst[lstIdx+2]: cnt +=1 a -=1 total += cnt print(f'#{test+1.. 2022. 8. 22. 이전 1 2 3 다음