백준 알고리즘 (Baekjoon Algorithm)
[파이썬] 백준 알고리즘 No.24498 blobnom - 블롭컵 대회
Universe_lee
2022. 2. 22. 14:13
https://acmicpc.net/problem/24498
24498번: blobnom
블롭들은 심심해서 서로를 이용해 $N$개의 탑을 만들었다. 각 탑의 높이는 그 탑에 있는 블롭의 수와 같다. 여러분은 다음 행동을 $0$회 이상 할 수 있다. 처음과 마지막이 아닌 탑 중 하나를 선
www.acmicpc.net
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = max(a)
for i in range(1, n - 1):
if min((a[i - 1], a[i + 1])) > 0:
ans = max((ans, a[i] + min((a[i - 1], a[i + 1]))))
print(ans)
문제를 풀려고 들어가보니 블롭 컵이라는 대회가 열리고 있어 찍먹 해 보았다.
난이도는 낮은 편