Skip to content

Instantly share code, notes, and snippets.

@wyukawa
Created August 13, 2012 13:00
Show Gist options
  • Save wyukawa/3340444 to your computer and use it in GitHub Desktop.
Save wyukawa/3340444 to your computer and use it in GitHub Desktop.
Ants
def solve(length, ants):
minimum = 0
maximum = 0
for ant in ants:
min_ant = min(ant, length-ant)
if min_ant > minimum:
minimum = min_ant
max_ant = max(ant, length-ant)
if max_ant > maximum:
maximum = max_ant
print "min=%d, max=%d" % (minimum, maximum)
solve(10, [2, 6, 7])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment