SWEA 1206. [S/W 문제해결 기본] 1일차 - View 파이썬
·
CodingTest
for i in range(1, 11) : N = int(input().strip()) blocks = list(map(int,input().split())) #blocks = [0,0,3,5,2,4,9,0,6,4,0,6,0,0] chomang = 0 for idx in range(2, len(blocks)-2) : left = idx - 2 right = idx + 3 left_side = max(blocks[left:idx]) right_side = max(blocks[idx+1:right]) #우리집이 제일 큰경우 if blocks[idx] > max(left_side, right_side) : chomang += blocks[idx] - max(left_side, right_side) print(..