Advertisement
Mihai_Preda

Untitled

Feb 7th, 2021
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     ifstream in("maxcif.in");
  9.     ofstream out("maxcif.out");
  10.     int f[10]= {0},n,i,v[100001],mx=0;
  11.     in>>n;
  12.     for(i=1; i<=n; i++)
  13.         in>>v[i];
  14.     for(i=1; i<=n; i++)
  15.         f[v[i]]++;
  16.     for(i=0; i<=9; i++)
  17.         if(f[i]>mx)
  18.             mx=f[i];
  19.     for(i=0; i<=9; i++)
  20.     {
  21.         if(f[i]==mx)
  22.             out<<i<<" ";
  23.     }
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement