#include<cstdio>
int main() {
int a, dp, maxT, left, right, leftmp, n;//不要随便定义在全局变量区,吃了很大的亏
while (scanf("%d", &n) != EOF) {
maxT = dp = left = right = 0;//初始化很重要!!!
for (int i = 0; i < n; i++) {
scanf("%d", &a);
if (dp > 0) dp += a; //dp状态为正可以继续加
else...