Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<fstream>
- using namespace std;
- ifstream fin("numere.in.cpp");
- int main()
- {
- int x,maxtot=0,contor=0,maxrand=0,lmin=INT_MAX;
- while(fin>>x)
- {
- if(x!=0)
- {
- contor++;
- if(x>maxrand)
- {
- maxrand=x;
- }
- }
- else
- {
- if(contor<lmin || contor==lmin &&
- maxrand>maxtot)
- {
- lmin=contor;
- maxtot=maxrand;
- }
- contor=0;
- maxrand=0;
- }
- }
- cout<<maxtot;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement