SWEA 1206 - View
24 Feb 2019 | Algorithm SWEA문제
- SWEA 1206 - [S/W 문제해결 기본] 1일차 - View
- 문제링크
- 문제의 저작권은 SW Expert Academy에 있습니다.
나의 코드
def GetMax(i):
max_floor = floor[i-2]
if max_floor < floor[i-1]:
max_floor = floor[i-1]
if max_floor < floor[i+1]:
max_floor = floor[i+1]
if max_floor < floor[i+2]:
max_floor = floor[i+2]
return max_floor
TC = 10
for tc in range(1, TC+1):
N = int(input())
floor = list(map(int, input().split()))
result = 0
for i in range(2, N-2):
side = GetMax(i)
if side < floor[i]:
result += floor[i] - side
print(f'#{tc} {result}')
Comments