728x90
SMALL
문제
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV134DPqAA8CFAYh
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
풀이
for test_case in range(1, 11):
n = int(input())
height=list(map(int,input().split()))
num_house=0
for j in range(2,n-2):
left=max(height[j-2],height[j-1])
right=max(height[j+1],height[j+2])
if left>height[j] or right>height[j]:
continue
else:
num_house+=(height[j]-max(left,right))
print(f"#{test_case} {num_house}")
728x90
LIST
'코테공부' 카테고리의 다른 글
[SW Expert Academy]1249. [S/W 문제해결 응용] 4일차 - 보급로 (0) | 2024.11.17 |
---|---|
[SW Expert Academy] 1244. [S/W 문제해결 응용] 2일차 - 최대 상금 (0) | 2024.11.16 |
[SW Expert Academy] 20936. 상자 정렬하기 (0) | 2024.11.15 |
[SW Expert Academy] 2072. 홀수만 더하기 (0) | 2024.11.12 |
프로그래머스: 영어 끝말잇기 (0) | 2024.08.11 |