Advertisement
yejolga

ol_4_14

Nov 3rd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     ifstream cin("input.txt");
  9.  
  10.     short n;
  11.     cin>>n;
  12.  
  13.     long mx = -1000000001;
  14.     short mxc = 0;
  15.     for(int i = 0; i < n; i++)
  16.     {
  17.         long cur;
  18.         cin>>cur;
  19.         if (cur > mx)
  20.         {
  21.             mxc = 1;
  22.             mx = cur;
  23.         }
  24.         else if (cur == mx)
  25.             mxc++;
  26.  
  27.     }
  28.     cout<<mx<<' '<<mxc;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement