Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream fin("crescatoare.in");
  4. ofstream fout("crescatoare.out");
  5. int n,i,a,b,lc,lmax;
  6. int main()
  7. {
  8. fin>>n;
  9. fin>>a;
  10. lmax = 1;
  11. lc = 1;
  12. for ( i = 1; i < n; i++ )
  13. {
  14. fin>>b;
  15. if ( b == a )
  16. {
  17. lc++;
  18. if ( lc > lmax )
  19. lmax = lc;
  20. }
  21. else
  22.  
  23. {
  24. a = b;
  25. lc = 1;
  26. }
  27. }
  28. fout<<lmax;
  29. fin.close();
  30. fout.close();
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement