题目 题解 n = int(input()) a = input().split() for i in range(len(a)): a[i] = int(a[i]) dp = [float("-inf")]*n dp[0] = a[0] res = a[0] for i in range(1,n): dp[i] = max(dp[i-1] + a[i],a[i]) res = max(res,dp[i]) print(res)