6 kyu

Simple Fun #165: Withdraw

576 of 1,713myjinxin2015

Description:

Task

An ATM ran out of 10 dollar bills and only has 100, 50 and 20 dollar bills.

Given an amount between 40 and 10000 dollars (inclusive) and assuming that the ATM wants to use as few bills as possible, determinate the minimal number of 100, 50 and 20 dollar bills the ATM needs to dispense (in that order).

Example

For n = 250, the result should be [2, 1, 0].

For n = 260, the result should be [2, 0, 3].

For n = 370, the result should be [3, 1, 1].

Input/Output

  • [input] integer n Amount of money to withdraw. Assume that n is always exchangeable with [100, 50, 20] bills.
  • [output] integer array An array of number of 100, 50 and 20 dollar bills needed to complete the withdraw (in that order).
Puzzles

Stats:

CreatedFeb 24, 2017
PublishedFeb 24, 2017
Warriors Trained4187
Total Skips222
Total Code Submissions9515
Total Times Completed1713
JavaScript Completions464
Python Completions576
Elixir Completions80
Crystal Completions7
Ruby Completions82
PHP Completions70
Java Completions326
C# Completions155
COBOL Completions5
C Completions55
Julia Completions5
Total Stars99
% of votes with a positive feedback rating93% of 348
Total "Very Satisfied" Votes309
Total "Somewhat Satisfied" Votes32
Total "Not Satisfied" Votes7
Total Rank Assessments12
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • ChibiKookie Avatar
  • smolen Avatar
  • kazk Avatar
  • tachyonlabs Avatar
  • Blind4Basics Avatar
  • rowcased Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad