Josif_tepe

Untitled

Nov 19th, 2025
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin>>n;
  9.     vector<pair<int,int>> rodendeni(n);
  10.     for(int i=0;i<n;i++)
  11.     {
  12.         int d,m;
  13.         cin>>d>>m;
  14.         rodendeni[i]={m,d};
  15.     }
  16.     sort(rodendeni.begin(),rodendeni.end());
  17.     vector<int> rodendeni_vo_mesec(13,0);
  18.     for(int i=0;i<n;i++)
  19.     {
  20.         if(i==0||rodendeni[i]!=rodendeni[i-1])
  21.             rodendeni_vo_mesec[rodendeni[i].first]++;
  22.     }
  23.     int max_rodendeni=-1;
  24.     for(int i=1;i<=12;i++)
  25.     {
  26.         if(rodendeni_vo_mesec[i]>max_rodendeni)
  27.             max_rodendeni=rodendeni_vo_mesec[i];
  28.     }
  29.     for(int i=1;i<=12;i++)
  30.     {
  31.         if(rodendeni_vo_mesec[i]==max_rodendeni)
  32.             cout<<i<<endl;
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment