1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <cstdio>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    unordered_map<unsigned long int, int> map;
    unsigned long int temp;
    for(int i = 0; i < n; i++)
    {
        scanf("%lu", &temp);
        map[temp]++;
    }

    for (int i = 1; i <= n; i++) {
        int count = 0;
        for (auto p : map) {
            count += (p.second-(p.second%i));
        }
        if (count == 0){
            char tempS[(((n-i+1)*2)-1)];
            for (int j = 0; j < ((n-i+1)*2)-1; j+=2)
            {
                tempS[j] = '0';
                if (j+1 >= ((n-i+1)*2)-1)
                {
                    tempS[j+1] = '\0';
                    break;
                }
                tempS[j+1] = ' ';
            }
            fputs(tempS, stdout);
            break;
        }
        printf("%d ", count);
    }

    return 0;
}