-
-
Save joffilyfe/bdd3e5a2cc14b44f0b08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
def to_dict(array): | |
temp = Counter(array) | |
return temp | |
def to_win(lista): | |
qtd = 0 | |
numero = 1000 | |
for i, item in enumerate(lista.items()): | |
if item[1] >= qtd: | |
if (item[1] > qtd): | |
numero = item[0] | |
qtd = item[1] | |
else: | |
if (item[0] < numero): | |
numero = item[0] | |
qtd = item[1] | |
return numero | |
entradas = int(input()) | |
while True: | |
try: | |
for e in range(entradas): | |
jogadores = [] | |
quant_votos = int(input()) | |
for n in range(quant_votos): | |
voto = int(input()) | |
jogadores.append(voto) | |
final = to_dict(jogadores) | |
final = to_win(final) | |
print final | |
except EOFError: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment