3 solutions
-
1
#include<bits/stdc++.h> using namespace std; int n; int a[1000005]; int main(){ cin>>n; int s=0; int w=0; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { int x=0; int y=0; for(int j=i+1;j<=n;j++) { if(a[j]==a[i]) { x+=1; } } if(x>s) { s=x; w=a[i]; } } cout<<w; return 0; }
Information
- ID
- 2870
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 1
- Tags
- # Submissions
- 89
- Accepted
- 26
- Uploaded By