Advertisement
SelinD

v99s3e4

May 7th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int start,lcrt=1,lmax=0,i;
  6. start=1;
  7. fin>>v[1];
  8. i=2;
  9. while(fin>>v[i])
  10. {
  11. if(v[i]%2==v[i-1]%2)
  12. {
  13. lcrt++;
  14. }
  15. else
  16. {
  17. if(lmax<lc)
  18. {
  19. lmax=lcrt;
  20. start=l-lcrt;
  21. }
  22. lcrt=1;
  23. }
  24. i++;
  25. }
  26. if(lmax<lcrt)
  27. {
  28. lmax=lcrt;
  29. start=i-lcrt;
  30. }
  31. cout<<lmax;
  32. for(i=start;i<start+lmax;i++)
  33. {
  34. cout<<v[i];
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement