n = int(input()) a = list(map(int,input().split())) d = dict() for i in a: if i in d: d[i] += 1 else: d[i] = 1 t = [d[i] for i in d] ans = [] p = 0 for i in range(1,n+1): s = 0 for j in t: s += j//i ans.append(str(s*i)) if s == 0: p = i+1 break for i in range(p,n+1): ans.append("0") print(" ".join(ans))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | n = int(input()) a = list(map(int,input().split())) d = dict() for i in a: if i in d: d[i] += 1 else: d[i] = 1 t = [d[i] for i in d] ans = [] p = 0 for i in range(1,n+1): s = 0 for j in t: s += j//i ans.append(str(s*i)) if s == 0: p = i+1 break for i in range(p,n+1): ans.append("0") print(" ".join(ans)) |