AlexandruT

[pbInfo] ciffrecv

Oct 28th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. ifstream fin("ciffrecv.in");
  5. ofstream fout("ciffrecv.out");
  6.  
  7. int frecv[10];
  8.  
  9. int main()
  10. {
  11.     int n;
  12.     while(fin >> n) frecv[n]++;
  13.     if(frecv[7]) fout << 7 << " " << frecv[7];
  14.     else if(frecv[5]) fout << 5 << " " << frecv[5];
  15.     else if(frecv[3]) fout << 3 << " " << frecv[3];
  16.     else if(frecv[2]) fout << 2 << " " << frecv[2];
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment