Advertisement
SelinD

v68s3e4

Feb 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. ifstream fin("sir.txt.cpp");
  5. int main()
  6. {
  7. int n,xant,x,lmax=0,lcrt=1,emax;
  8. fin>>n;
  9. fin>>xant;
  10. while(fin>>x)
  11. {
  12. if(xant==x) lcrt++;
  13. else
  14. {
  15. if(lcrt>=lmax)
  16. {
  17. lmax=lcrt;
  18. emax=x;
  19. }
  20. lcrt=1;
  21. }
  22. xant=x;
  23. }
  24. if(lcrt>=lmax)
  25. {
  26. lmax=lcrt;
  27. emax=x;
  28. }
  29. cout<<lmax<<" "<<emax;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement