n = int(input()) miasta = input().split() counts = {} for value in miasta: if value in counts: counts[value] += 1 else: counts[value] = 1 result = list(counts.values()) result.sort(reverse=True) odp = str(len(miasta))+" " dlugosc=1 for i in range(2,n+1): ilosc = 0 for j in range(len(result)): if result[j]>=i: ilosc+=(result[j]//i)*i else: result=result[:j] break if ilosc==0: odp+="0 "*(int(n)-dlugosc) break else: dlugosc+=1 odp+=str(ilosc)+" " print(odp[:-1])
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 | n = int(input()) miasta = input().split() counts = {} for value in miasta: if value in counts: counts[value] += 1 else: counts[value] = 1 result = list(counts.values()) result.sort(reverse=True) odp = str(len(miasta))+" " dlugosc=1 for i in range(2,n+1): ilosc = 0 for j in range(len(result)): if result[j]>=i: ilosc+=(result[j]//i)*i else: result=result[:j] break if ilosc==0: odp+="0 "*(int(n)-dlugosc) break else: dlugosc+=1 odp+=str(ilosc)+" " print(odp[:-1]) |