Created
August 5, 2015 13:28
-
-
Save davidecavaliere/43610678ebc8a6b28361 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
import itertools; | |
permutations = itertools.permutations([100,250,1000, 1200]); | |
times = [] | |
for it in permutations : | |
print it | |
presum = 0; | |
roundTrip = [] | |
sums = []; | |
for i in range(len(it)) : | |
el = it[i]; | |
presum += el; | |
if (i!=0) : roundTrip.append(presum) | |
print roundTrip | |
times.append(sum(roundTrip)) | |
print times | |
print 'minimum time', min(times); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment