Advertisement
a53

cuburi4

a53
Nov 20th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. using namespace std;
  4. long long H,h_max,maxi_pare;
  5. long long C,latura1,latura2,n,i,l;
  6.  
  7. int main()
  8. {
  9. cin>>C>>n;
  10. if (C==1)
  11. {
  12. l=0;
  13. for(i=1;i<=n;++i)
  14. {
  15. cin>>latura1;
  16. l=0;
  17. while(latura1%2==0&&i<=n)
  18. ++l,cin>>latura1,++i;
  19. if (l>maxi_pare)
  20. maxi_pare=l;
  21. }
  22. cout<<maxi_pare<<'\n';
  23. }
  24. else
  25. {
  26. cin>>latura1;
  27. h_max=H=latura1;
  28.  
  29. for(i=1;i<=n-1;++i)
  30. {
  31. cin>>latura2;
  32. if(latura2<latura1)
  33. H=H+latura2;
  34. else
  35. H=latura2;
  36. if(H>h_max)
  37. h_max=H;
  38. latura1=latura2;
  39. }
  40. cout<<h_max<<'\n';
  41. }
  42. return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement