ENG  RUS Timus 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 test №6 Python
Posted by Alex 24 Feb 2019 01:36
import math

nm = input().split()
n = int(nm)
m = int(nm)
res = set()
result = []
for i in range(m):
x = int(input())
if x not in res:
res.add(x)
result.append(x)
answer = []
for i in res:
answer.append(result.count(i))
while n - len(answer) > 0:
answer.append(0)
for i in answer:
v = str(round(i*100/m, 2))
if v[-2] + v[-1] == '.0':
print(str(round(i*100/m, 2)) + '0%')
else:
print(str(round(i*100/m, 2)) + '%')

Edited by author 24.02.2019 01:39

Edited by author 09.03.2019 03:19
Re: WA test №6 Python
Posted by Pav1off 14 Jul 2019 02:59
n, m = [int(x) for x in input().split()]
x = 0
k = *(n)
for i in range(m):
x = int(input())
k[x-1] = k[x-1]+1

for u in range(n):
print( "%.2f" % (k[u]*100/ m), "%", sep="" )