Cody

# Problem 48. Making change

Solution 1395241

Submitted on 27 Dec 2017 by baruch braude
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a = [257.68]; b = [2 1 0 0 1 1 0 1 0 1 1 3]; out = makingChange(a); assert(isequal(out(:), b(:)))

v = 100.0000 50.0000 20.0000 10.0000 5.0000 2.0000 1.0000 0.5000 0.2500 0.1000 0.0500 0.0100 b = [] s = 2.5868 x = 2 a = 57.6800 b = 2 s = 1.1636 x = 1 a = 7.6800 b = 2 1 s = 0.3940 x = 0 a = 7.6800 b = 2 1 0 s = 0.7780 x = 0 a = 7.6800 b = 2 1 0 0 s = 1.5460 x = 1 a = 2.6800 b = 2 1 0 0 1 s = 1.3500 x = 1 a = 0.6800 b = 2 1 0 0 1 1 s = 0.6900 x = 0 a = 0.6800 b = 2 1 0 0 1 1 0 s = 1.3700 x = 1 a = 0.1800 b = 2 1 0 0 1 1 0 1 s = 0.7300 x = 0 a = 0.1800 b = 2 1 0 0 1 1 0 1 0 s = 1.8100 x = 1 a = 0.0800 b = 2 1 0 0 1 1 0 1 0 1 s = 1.6100 x = 1 a = 0.0300 b = 2 1 0 0 1 1 0 1 0 1 1 s = 3.0100 x = 3 a = 6.8140e-15 b = 2 1 0 0 1 1 0 1 0 1 1 3

2   Pass
a = [135.01]; b = [1 0 1 1 1 0 0 0 0 0 0 1]; out = makingChange(a); assert(isequal(out(:), b(:)))

v = 100.0000 50.0000 20.0000 10.0000 5.0000 2.0000 1.0000 0.5000 0.2500 0.1000 0.0500 0.0100 b = [] s = 1.3601 x = 1 a = 35.0100 b = 1 s = 0.7102 x = 0 a = 35.0100 b = 1 0 s = 1.7605 x = 1 a = 15.0100 b = 1 0 1 s = 1.5110 x = 1 a = 5.0100 b = 1 0 1 1 s = 1.0120 x = 1 a = 0.0100 b = 1 0 1 1 1 s = 0.0150 x = 0 a = 0.0100 b = 1 0 1 1 1 0 s = 0.0200 x = 0 a = 0.0100 b = 1 0 1 1 1 0 0 s = 0.0300 x = 0 a = 0.0100 b = 1 0 1 1 1 0 0 0 s = 0.0500 x = 0 a = 0.0100 b = 1 0 1 1 1 0 0 0 0 s = 0.1100 x = 0 a = 0.0100 b = 1 0 1 1 1 0 0 0 0 0 s = 0.2100 x = 0 a = 0.0100 b = 1 0 1 1 1 0 0 0 0 0 0 s = 1.0100 x = 1 a = -9.0952e-15 b = 1 0 1 1 1 0 0 0 0 0 0 1

3   Pass
a = [10035.99]; b = [100 0 1 1 1 0 0 1 1 2 0 4]; out = makingChange(a); assert(isequal(out(:), b(:)))

v = 100.0000 50.0000 20.0000 10.0000 5.0000 2.0000 1.0000 0.5000 0.2500 0.1000 0.0500 0.0100 b = [] s = 100.3699 x = 100 a = 35.9900 b = 100 s = 0.7298 x = 0 a = 35.9900 b = 100 0 s = 1.8095 x = 1 a = 15.9900 b = 100 0 1 s = 1.6090 x = 1 a = 5.9900 b = 100 0 1 1 s = 1.2080 x = 1 a = 0.9900 b = 100 0 1 1 1 s = 0.5050 x = 0 a = 0.9900 b = 100 0 1 1 1 0 s = 1.0000 x = 0 a = 0.9900 b = 100 0 1 1 1 0 0 s = 1.9900 x = 1 a = 0.4900 b = 100 0 1 1 1 0 0 1 s = 1.9700 x = 1 a = 0.2400 b = 100 0 1 1 1 0 0 1 1 s = 2.4100 x = 2 a = 0.0400 b = 100 0 1 1 1 0 0 1 1 2 s = 0.8100 x = 0 a = 0.0400 b = 100 0 1 1 1 0 0 1 1 2 0 s = 4.0100 x = 4 a = -2.1829e-13 b = 100 0 1 1 1 0 0 1 1 2 0 4