Advertisement
Mihai_Preda

Untitled

Feb 7th, 2021
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 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[100002],mx=0;
  11.     i = 1;
  12.     while(in >> v[i])
  13.         i++;
  14.     n = i-1;
  15.     for(i=1; i<=n; i++)
  16.         f[v[i]]++;
  17.     for(i=0; i<=9; i++)
  18.         if(f[i]>mx)
  19.             mx=f[i];
  20.     for(i=0; i<=9; i++)
  21.     {
  22.         if(f[i]==mx)
  23.             out<<i<<" ";
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement