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
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> numbers;
    vector<int> counts;
    for (int i = 0; i < n; i++) {
        int k;
        cin>>k;
        int index=0;
        for(;index<numbers.size();index++){
            if(numbers[index]==k){
                break;
            }
        }
        if(index==numbers.size()){
            numbers.push_back(k);
            counts.push_back(1);
        }
        else{
            counts[index]++;
        }
    }
    for(int i=1;i<=n;i++){
        int counter = 0;
        for(int j=0;j<numbers.size();j++){
            counter+=counts[j]/i;
        }
        cout<<counter*i<<" ";
    }
    return 0;
}