import sys """ 用前缀和做,时间复杂度为o(n^2),在本题中会超时 下面是动态规划解决,时间复杂度为o(n),解决超时问题 n = int(input()) l = list(map(int, input().split())) for i in range(1, len(l)): l[i] = l[i - 1] + l[i] if n == 1: print(l[0]) else: dp = [l[0]] for i in range(1, len(l)): dp.append(l[i]) for j in r...