Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("platou1.in");
- ofstream fout("platou1.out");
- int main()
- {
- int x,y,lmax=0,lung=1,minn=999999999;
- fin>>x;
- while(fin>>y){
- if(x==y){
- lung++;
- }
- else{
- if(lung>lmax){
- lmax=lung;
- minn=x;
- }
- else
- {
- if(lmax==lung){
- if(x<minn){
- minn=x;
- }
- }
- }
- lung=1; ///sirul este format doar din y
- }
- x=y;
- }
- if(lung>lmax){
- minn=y;
- lmax=lung;
- }
- else{
- if(lung==lmax){
- if(y<minn){
- minn=y;
- }
- }
- }
- fout<<lmax<<" "<<minn;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement