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
#include <iostream>
#include <unordered_map>
#include <vector>

int main()
{
	int n;
	std::cin >> n;
	std::unordered_map<int, int> count;
	int temp;
	for (int i = 0; i < n; i++)
	{
		std::cin >> temp;
		count[temp]++;
	}

	int sum = 0;
	bool _break = false;
	for (int i = 1; i <= n; i++)
	{
		sum = 0;
		if (!_break)
		{
			for (std::pair<int, int> val : count)
			{
				sum += (val.second / i) * i;
			}
		}
		if (sum == 0)
		{
			_break = true;
		}
		std::cout << sum << " ";
	}

	return 0;
}