Advertisement
Alhiris

Untitled

Feb 18th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1.  
  2.  
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5. //ifstream fin("permuta.in");
  6. //ofstream fout("permuta.out");
  7. #define f first
  8. #define s second
  9. #define pb push_back
  10. #define FOR(i,a,b) for(i=(a);i<=(b);++i)
  11. #define FORS(i,a,b) for(i=(a);i<(b);++i)
  12. #define vpp vector<pair<int,int>>
  13. #define ll long long
  14. #define maxn 100005
  15.  
  16. int n;
  17. int v[maxn];
  18.  
  19. int main()
  20. {
  21. //  freopen("subsecvente2.in","r",stdin);
  22. //  freopen("subsecvente2.out","w",stdout);
  23.     int i,maxi=-1,cnt,mcnt=0;
  24.     cin>>n;
  25.     FOR(i,1,n){
  26.         cin>>v[i];
  27.         if(maxi<v[i])
  28.             maxi=v[i];
  29.     }
  30.     FOR(i,1,n){
  31.         if(v[i]==maxi){
  32.             cnt=0;
  33.             while(v[i]==maxi&&i<=n)
  34.                 ++cnt,++i;
  35.             mcnt=max(mcnt,cnt);
  36.         }
  37.     }
  38.     cout<<mcnt;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement