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