[2016][ruby][24.1]

profile
Alpha Chen 8 years ago
parent ce59553d97
commit ffaed85e78

@ -96,6 +96,7 @@ if __FILE__ == $0
.map(&:first) .map(&:first)
.permutation .permutation
.select {|route| route[0] == 0 } .select {|route| route[0] == 0 }
.map {|route| route + [0] }
.map {|route| .map {|route|
[route, route.each_cons(2).map {|a,b| hash[[a,b]] }.inject(:+)] [route, route.each_cons(2).map {|a,b| hash[[a,b]] }.inject(:+)]
}.sort_by(&:last) }.sort_by(&:last)

Loading…
Cancel
Save