Advertisement
STANAANDREY

scriitori

Dec 15th, 2020
710
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. using namespace std;
  3. #define MAXYEAR 2020
  4. int n, fr[MAXYEAR];
  5.  
  6. int main() {
  7.     cin >> n;
  8.     for (int i = 1; i <= n; i++) {
  9.         int a, b;
  10.         cin >> a >> b;
  11.         for (int y = a; y <= b; y++)
  12.             fr[y]++;
  13.     }
  14.     int maxi = 0, ry;
  15.     for (int y = 1; y <= MAXYEAR; y++)
  16.         if (maxi < fr[y]) {
  17.             maxi = fr[y];
  18.             ry = y;
  19.         }
  20.     cout << ry << endl;
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement