fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. cout.setf(ios::fixed);
  8. cout.precision(0);
  9.  
  10. int n,c;
  11. cin>>n;
  12. long double suma=0;
  13. long double makskasa=0;
  14.  
  15. while (n--)
  16. {
  17. cin >>c;
  18. suma+=c;
  19.  
  20.  
  21. if (makskasa<suma)
  22. {
  23. makskasa=suma;
  24. }
  25.  
  26.  
  27. if (0>suma)
  28. {
  29. suma=0;
  30. }
  31. }
  32. cout<<makskasa << endl ;
  33. return 0;
  34. }
  35.  
Time limit exceeded #stdin #stdout 5s 4488KB
stdin
Standard input is empty
stdout
Standard output is empty