Advertisement
SelinD

V83s3e4

Mar 12th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<fstream>
  4. using namespace std;
  5. ifstream fin("numere.in.cpp");
  6. int main()
  7. {
  8. int x,maxtot=0,contor=0,maxrand=0,lmin=INT_MAX;
  9. while(fin>>x)
  10. {
  11. if(x!=0)
  12. {
  13. contor++;
  14. if(x>maxrand)
  15. {
  16. maxrand=x;
  17. }
  18. }
  19. else
  20. {
  21. if(contor<lmin || contor==lmin &&
  22. maxrand>maxtot)
  23. {
  24. lmin=contor;
  25. maxtot=maxrand;
  26. }
  27. contor=0;
  28. maxrand=0;
  29. }
  30. }
  31. cout<<maxtot;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement