Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- ifstream fin("sir.txt.cpp");
- int main()
- {
- int n,xant,x,lmax=0,lcrt=1,emax;
- fin>>n;
- fin>>xant;
- while(fin>>x)
- {
- if(xant==x) lcrt++;
- else
- {
- if(lcrt>=lmax)
- {
- lmax=lcrt;
- emax=x;
- }
- lcrt=1;
- }
- xant=x;
- }
- if(lcrt>=lmax)
- {
- lmax=lcrt;
- emax=x;
- }
- cout<<lmax<<" "<<emax;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement