题解 | #最大上升子序列和#
最大上升子序列和
https://www.nowcoder.com/practice/dcb97b18715141599b64dbdb8cdea3bd
n = int(input()) num = list(map(int, input().split(" "))) dp = list(num)#记住,一定要加个list(),否则就是同一个内存地址 for i in range(n): for j in range(i): if num[j] < num[i]: dp[i] = max(dp[i], num[i] + dp[j]) print(max(dp))