2 solutions
-
1
#include<bits/stdc++.h> using namespace std; const int N=1e4+10; int a[N]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } int last=a[1]-1,now=0,ans=0,best=0; for(int i=1;i<=n;i++){ if(a[i]==last) now++; else{ last=a[i]; now=1; } if(now>ans){ ans=now; best=a[i]; } } cout<<best<<endl; return 0; }
Information
- ID
- 3605
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- # Submissions
- 28
- Accepted
- 9
- Uploaded By