Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int den[n], mesec[n];
- for(int i = 0; i < n; i++) {
- cin >> den[i] >> mesec[i];
- }
- int rodendeni[32][13];
- for(int i = 0; i <= 31; i++) {
- for(int j = 0; j <= 12; j++) {
- rodendeni[i][j] = 0;
- }
- }
- for(int i = 0; i < n; i++) {
- rodendeni[den[i]][mesec[i]]++;
- }
- int maksimum_rodendeni = 0;
- for(int i = 1; i <= 12; i++) {
- int kolku_rodendeni_imalo_toj_mesec = 0;
- for(int j = 1; j <= 31; j++) {
- if(rodendeni[j][i] > 0) {
- kolku_rodendeni_imalo_toj_mesec++;
- }
- }
- if(kolku_rodendeni_imalo_toj_mesec > maksimum_rodendeni) {
- maksimum_rodendeni = kolku_rodendeni_imalo_toj_mesec;
- }
- }
- for(int i = 1; i <= 12; i++) {
- int kolku_rodendeni_imalo_toj_mesec = 0;
- for(int j = 1; j <= 31; j++) {
- if(rodendeni[j][i] > 0) {
- kolku_rodendeni_imalo_toj_mesec++;
- }
- }
- if(kolku_rodendeni_imalo_toj_mesec == maksimum_rodendeni) {
- cout << i << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement