fork download
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. ifstream fin("ciffrecv.in");
  6. ofstream fout("ciffrecv.out");
  7.  
  8. int main() {
  9. int x, mx = 0, nr = 0;
  10. while(cin >> x) {
  11. if(x == 2 || x == 3 || x == 5 || x == 7) {
  12. if(x > mx) {
  13. mx = x;
  14. nr = 1;
  15. }
  16. else if(mx == x) {
  17. nr++;
  18. }
  19. }
  20. }
  21. cout << mx << ' ' << nr;
  22. }
Success #stdin #stdout 0.01s 5292KB
stdin
5 8 9 1 9 5 
1 1 2 2 
stdout
5 2