dist=->a,b{[(b-a)%10,(a-b)%10].min} $<.map{|l| d=l.to_i a,b,c=d/100,d/10%10,d%10 #p d p [dist[a,b]+dist[a,c], dist[b,a]+dist[b,c], dist[c,a]+dist[c,b]].min }
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page