Last active
August 29, 2015 14:22
-
-
Save ZengetsuFR/53e54c7aa82e2106c45e to your computer and use it in GitHub Desktop.
Résolution du jeu "Chevaux de course" sur le site codingame.com
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
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