ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1263. Elections

WA 6, python 3.8, plz help me
Posted by klimvetoshkin 28 Jan 2023 11:58
n, m = map(int, input().split())
a = []
b = [1]
c = []
for i in range(m):
    f = int(input())
    a.append(f)
a = sorted(a)
f = 0
for i in range(1, len(a)):
    if a[i] == a[i - 1]:
       b[f] += 1
    elif a[i] != a[i - 1]:
        b.append(1)
        f += 1
for i in range(len(b)):
    b[i] = float(b[i] / m * 100)
for i in range(len(b)):
    c.append('%.2f' % b[i] + '%')
for i in range(n):
    try:
        print(c[i])
    except:
        print('0.00%')