#include<iostream>
#include "maklib.h"
using namespace std;
int m,s;
int main()
{
ios_base::sync_with_stdio(false);
for(int i=1;i<=Size();i++)
{
s+=ElementAt(i);
m=s>m?s:m;
s=s<0?0:s;
}
cout<<m;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<iostream> #include "maklib.h" using namespace std; int m,s; int main() { ios_base::sync_with_stdio(false); for(int i=1;i<=Size();i++) { s+=ElementAt(i); m=s>m?s:m; s=s<0?0:s; } cout<<m; } |
English