관리 메뉴

일서방

백준17608번 - 막대기 본문

IT공부/Algorithm(with.파이썬)

백준17608번 - 막대기

0asis 2023. 7. 26. 20:01

 

 

소스 : 

def solution(sticks):
    answer = sticks[len(sticks)-1]
    count  = 1
    for i in range(len(sticks)-2 , -1 , -1):
        if sticks[i] > answer :
            count = count +1
            answer = sticks[i]
       
    return count


n = int(input())
arr = []
for i in range(n):
    arr.append(int(input()))
print(solution(arr))

 

'IT공부 > Algorithm(with.파이썬)' 카테고리의 다른 글

문제 : 빈도수  (1) 2023.07.26
해시테이블  (0) 2023.07.26
3. 연속된 '1'의 길이  (0) 2023.07.24
2.합격생 수 구하기  (0) 2023.07.24
1. 최솟값의 위치구하기  (0) 2023.07.24