Add tags

Add tags to the following comment
短くしてみた。
%= のところでハイライトがおかしくなるのが悲しい。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def pay(e, h)
  h.default = 0
  h.each {|c,n| e -= c*n }
  raise "Money!" if (e *= -1) < 0
  [500,100,50,10,5,1].each do |c|
    h[c] -= e/c
    e %= c
  end
  h.reject {|c,n| n <= 0}
end

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...