#include<stdio.h>
int main(){
int result = 0,thissum = 0, N, digit;
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%d", &digit);
thissum += digit;
if(thissum > result)
result = thissum;
if(thissum < 0) thissum = 0;
}
printf("%d", result);
return 0;
}
原文地址:https://www.cnblogs.com/zjsaipplp/p/10424838.html
时间: 2024-10-12 11:50:38