fork(1) download
  1. f=->i{i=i.split.map(&:to_i);(1..4).each{|n|i[-n-1]+=i[-n]/2;i[-n]%=2};i}
  2.  
  3. p f.call("3 8 6 0 2")
Success #stdin #stdout 0.01s 7452KB
stdin
Standard input is empty
stdout
[8, 1, 0, 1, 0]