Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int a,b,c;
- int e=0;
- int d=0;
- cin>>a;
- for(b=0;b<a;b++)
- {
- cin>>c;
- d=c+d;
- if(d<=0)
- {
- d=0;
- }
- if(d>e)
- {
- e=d;
- }
- }
- cout<<e<<" "<<d<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement