题目描述
python版本
py
import sys
gird = []
for line in sys.stdin:
gird.append((line.split()))
n = int((gird.pop(0))[0])
gird = [int(i) for i in gird[0]]
#题解
# if not gird:return 0
dp = gird[:]
for i in range(n):
for j in range(i):
if gird[i] > gird[j]:
dp[i] = max(dp[i],gird[i]+dp[j])
print(max(dp))