- 2022tysc0158 的博客
【模板】最大连续子段和
- 2023-11-8 11:23:00 @
#include<iostream>
#include<cstdio>
using namespace std;
int n,num,maxx,nx,x;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&num);
nx=max(nx,x+num);
maxx=max(maxx,nx);
x=nx,nx=0;
}
printf("%d",maxx);
}