cupsamada

518

Mar 6th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int v[1005];
  4. int main()
  5. {
  6. int lcr=0, lmax=0, n, i, start, stop;
  7. cin>>n;
  8. for(i=1; i<=n; i++)
  9. {
  10. cin>>v[i];
  11. if(v[i]==0)
  12. {
  13. lcr++;
  14. }
  15. else
  16. {
  17. if(lmax<lcr)
  18. {
  19. lmax=lcr;
  20. start=i-lcr;
  21. stop=i-1;
  22. }
  23. lcr=0;
  24. }
  25. }
  26. if(lmax<lcr)
  27. {
  28. lmax=lcr;
  29. start=i-lcr;
  30. stop=i-1;
  31. }
  32. cout<<start<<" "<<stop;
  33. return 0;
  34. }
Add Comment
Please, Sign In to add comment