Skip to content

Instantly share code, notes, and snippets.

@ZengetsuFR
Last active August 29, 2015 14:22
Show Gist options
  • Save ZengetsuFR/53e54c7aa82e2106c45e to your computer and use it in GitHub Desktop.
Save ZengetsuFR/53e54c7aa82e2106c45e to your computer and use it in GitHub Desktop.
Résolution du jeu "Chevaux de course" sur le site codingame.com
import sys, math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
N = int(raw_input())
lstValue = []
lstSorted = []
ecartDico = []
for i in xrange(N):
Pi = int(raw_input())
lstValue.append(Pi)
#trier pour avoir les valeurs proches à la suite
lstValue.sort()
#calcul ecart
for i in xrange(N-1):
ecartDico.append(abs(lstValue[i]-lstValue[i+1]))
print min(ecartDico)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment