백준 - DP (#11055)

Eon·2020년 10월 2일
0

Algorithm

목록 보기
18/70

https://www.acmicpc.net/problem/11055
수열 A가 주어졌을 때, 그 수열의 증가 부분 수열 중에서 합이 가장 큰 것을 구하는 프로그램을 작성하시오.

Code

n = int(input())
a = list(map(int, input().split()))
results = [0]*n
for i in range(len(a)):
    for j in range(len(a)):
        if a[i] > a[j] and results[i] < results[j]:
            results[i] = results[j]
    results[i] += a[i]
print(max(results))  
profile
👨🏻‍💻 🏃🏻‍♂️ 🎶

0개의 댓글