import collections n=int(input()) C=input().split() A=[int(i) for i in C] r=[] d=[] j=0 f=[] R=[] for i in A: if i not in r: r.append(i) while j<len(r): h=A.count(int(r[j])) d.append(h) j+=1 for k in range(n+1): if k!=0: for l in range(len(d)): f.append(int((d[l])/k)) s=sum(f)*k f=[] R.append(s) R.pop(0) print(*R, sep=' ')
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 | import collections n=int(input()) C=input().split() A=[int(i) for i in C] r=[] d=[] j=0 f=[] R=[] for i in A: if i not in r: r.append(i) while j<len(r): h=A.count(int(r[j])) d.append(h) j+=1 for k in range(n+1): if k!=0: for l in range(len(d)): f.append(int((d[l])/k)) s=sum(f)*k f=[] R.append(s) R.pop(0) print(*R, sep=' ') |