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