Skip to content

Latest commit

 

History

History

223-alternative-reality

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Alternative reality

Challenge Description:

Have you even wondered about another life? Maybe there is an alternative reality where different things are happening. Everything is almost the same, but still a bit different…
You are walking in one reality, but driving the car in another. Here you like golf, and there – basketball. In one reality you changed a $100 banknote to five $20 banknotes, while in another – to ten $10 banknotes.
Today, your task is to count how many alternative versions of money change are if you have 1¢, 5¢, 10¢, 25¢, and 50¢ coins.
So, if you have 11 cents that you need to change, you have four alternative ways how to do it:

1+1+1+1+1+1+1+1+1+1+1
5+1+1+1+1+1+1
5+5+1
10+1

Input sample:

The first argument is a path to a file. Each line includes a test case with the number of cents that you want to change.

100
4
17

Output sample:

Print the number of alternative ways to change money.

292
1
6

Constraints:

  1. Number of cents can be from 1 to 100.
  2. You have 1¢, 5¢, 10¢, 25¢, and 50¢ coins to do the change.
  3. The number of test cases is 30.