Advertisement
Josif_tepe

Untitled

Feb 12th, 2024
1,203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.    
  9.     int rodendni[13][32];
  10.     for(int i = 1; i <= 12; i++) {
  11.         for(int j = 1; j <= 31; j++) {
  12.             rodendni[i][j] = 0;
  13.         }
  14.     }
  15.     for(int i = 0; i < n; i++) {
  16.         int x, y;
  17.         cin >> x >> y;
  18.         rodendni[y][x] = 1;
  19.     }
  20.     int max_brojac = 0;
  21.     for(int mesec = 1; mesec <= 12; mesec++) {
  22.         int brojac = 0;
  23.         for(int den = 1; den <= 31; den++) {
  24.             if(rodendni[mesec][den] == 1) {
  25.                 brojac++;
  26.             }
  27.         }
  28.         max_brojac = max(max_brojac, brojac);
  29.     }
  30.     for(int mesec = 1; mesec <= 12; mesec++) {
  31.         int brojac = 0;
  32.         for(int den = 1; den <= 31; den++) {
  33.             if(rodendni[mesec][den] == 1) {
  34.                 brojac++;
  35.             }
  36.         }
  37.        
  38.         if(max_brojac == brojac) {
  39.             cout << mesec << endl;
  40.         }
  41.     }
  42.    
  43.     return 0;
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement