Programming/SW Expert Academy

20200723 // 삼성 SW Expert 아카데미 문제 // 1206

껨코 2020. 7. 23. 15:43

삼성 SW Expert 아카데미 1206번 "View" 문제입니다.

 

for tc in range(1, 11):
    N = int(input())
    lst = list(map(int, input().split()))
    build_sum = 0
    for i in range(2,N-2):
        if lst[i] != max(lst[i-2:i+3]):
            continue
        else:
            if lst[i] - lst[i-2] >=1 and lst[i] - lst[i-1] >=1 and lst[i] - lst[i+1] >=1 and lst[i] - lst[i+2] >=1:
               build_sum += lst[i] - max(lst[i-2], lst[i-1], lst[i+1], lst[i+2]) 
    print("#%s"%tc, build_sum

 

크게 어렵지는 않은 문제다. 딱히 코멘트 적을 것도 없고... 문제를 잘 이해만 한다면 풀 수 있는 문제다. 

 

 

스터디 카페인데 배고프다ㅎ..