Guest User

Untitled

a guest
Jan 10th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. cin>>n;
  9. int niza[n+10];
  10. for(int i=0;i<n;i++)
  11. {
  12. cin>>n;
  13. }
  14. int best=0;
  15. int sum=0;
  16. for(int i=0;i<n;i++)
  17. {
  18. sum=max(niza[i], sum+niza[i]);
  19. best=max(best, sum);
  20. }
  21. cout<<best<<endl;
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment