Home > frevo-on-rails-problema-1

frevo-on-rails-problema-1

Frevo-on-rails-problema-1 is a project mainly written in Ruby, it's free.

Problema 1 - Caixa Eletrônico (Versão Alternativa)

FREVO ON RAILS

Pernambuco Ruby User Group

Problem 1 - Cash Machine (ATM)

Problem Description

What is the minimum set of bills that sums up to a given amount of money? Assume the machine is provided an unlimited amount of bills in the following values: 2, 5, 10, 20, 50 and 100.

Sample Usage and Expected Output

$ bin/atm 107 248
For $ 107:
  1 * $ 100
  1 * $   5
  1 * $   2

For $ 248:
  2 * $ 100
  2 * $  20
  4 * $   2

$ bin/atm 11
Unable to withdraw $ 11.

Setting up the test environment

$ gem install bundler
$ bundle install
$ autotest

If you don't like autotest and autotest-growl, just run:

$ bundle install --without autotest

Contributing

  1. Fork it
  2. Change it
  3. Red, yellow, green
  4. Send a pull request

Mail us at [email protected] if you need help.