Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
Created August 19, 2015 19:48
Show Gist options
  • Save joffilyfe/bdd3e5a2cc14b44f0b08 to your computer and use it in GitHub Desktop.
Save joffilyfe/bdd3e5a2cc14b44f0b08 to your computer and use it in GitHub Desktop.
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