Cody

# Problem 45385. Coin distribution

Solution 2194273

Submitted on 5 Apr 2020 by Martin C.
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
y=[2000 100 1 2] assert(isequal(coin(2200),y))

y = 2000 100 1 2 c2 = 1 n = 200 c2 = 1 0 n = 200 c2 = 1 0 0 n = 200 c2 = 1 0 0 2 n = 0 c2 = 1 0 0 2 0 n = 0 c2 = 1 0 0 2 0 0 n = 0 c2 = 1 0 0 2 0 0 0 n = 0 c2 = 1 0 0 2 0 0 0 0 n = 0 c2 = 1 0 0 2 0 0 0 0 0 n = 0 c2 = 1 0 0 2 0 0 0 0 0 0 n = 0 y = 2000 100 1 2 out = 2000 100 1 2

2   Pass
y=[100,20,2;2,1,1] assert(isequal(coin(222),y))

y = 100 20 2 2 1 1 c2 = 0 n = 222 c2 = 0 0 n = 222 c2 = 0 0 0 n = 222 c2 = 0 0 0 2 n = 22 c2 = 0 0 0 2 0 n = 22 c2 = 0 0 0 2 0 1 n = 2 c2 = 0 0 0 2 0 1 0 n = 2 c2 = 0 0 0 2 0 1 0 0 n = 2 c2 = 0 0 0 2 0 1 0 0 1 n = 0 c2 = 0 0 0 2 0 1 0 0 1 0 n = 0 y = 100 20 2 2 1 1 out = 100 20 2 2 1 1

3   Pass
y=[2000 500 100 50 20 10 5 2 1 3 1 2 1 1 1 1 1 1] assert(isequal( coin(6788),y))

y = 2000 500 100 50 20 10 5 2 1 3 1 2 1 1 1 1 1 1 c2 = 3 n = 788 c2 = 3 0 n = 788 c2 = 3 0 1 n = 288 c2 = 3 0 1 2 n = 88 c2 = 3 0 1 2 1 n = 38 c2 = 3 0 1 2 1 1 n = 18 c2 = 3 0 1 2 1 1 1 n = 8 c2 = 3 0 1 2 1 1 1 1 n = 3 c2 = 3 0 1 2 1 1 1 1 1 n = 1 c2 = 3 0 1 2 1 1 1 1 1 1 n = 0 y = 2000 500 100 50 20 10 5 2 1 3 1 2 1 1 1 1 1 1 out = 2000 500 100 50 20 10 5 2 1 3 1 2 1 1 1 1 1 1

4   Pass
y=[2000 100 20 5 2 1 56728 3 2 1 1 1] assert(isequal( coin(113456348),y))

y = 2000 100 20 5 2 1 56728 3 2 1 1 1 c2 = 56728 n = 348 c2 = 56728 0 n = 348 c2 = 56728 0 0 n = 348 c2 = 56728 0 0 3 n = 48 c2 = 56728 0 0 3 0 n = 48 c2 = 56728 0 0 3 0 2 n = 8 c2 = 56728 0 0 3 0 2 0 n = 8 c2 = 56728 0 0 3 0 2 0 1 n = 3 c2 = 56728 0 0 3 0 2 0 1 1 n = 1 c2 = 56728 0 0 3 0 2 0 1 1 1 n = 0 y = 2000 100 20 5 2 1 56728 3 2 1 1 1 out = 2000 100 20 5 2 1 56728 3 2 1 1 1

5   Pass
y=[2;2] assert(isequal( coin(4),y))

y = 2 2 c2 = 0 n = 4 c2 = 0 0 n = 4 c2 = 0 0 0 n = 4 c2 = 0 0 0 0 n = 4 c2 = 0 0 0 0 0 n = 4 c2 = 0 0 0 0 0 0 n = 4 c2 = 0 0 0 0 0 0 0 n = 4 c2 = 0 0 0 0 0 0 0 0 n = 4 c2 = 0 0 0 0 0 0 0 0 2 n = 0 c2 = 0 0 0 0 0 0 0 0 2 0 n = 0 y = 2 2 out = 2 2

6   Pass
y=[1000 100 20 5 2 1 4 2 1 2] assert(isequal( coin(1449),y))

y = 1000 100 20 5 2 1 4 2 1 2 c2 = 0 n = 1449 c2 = 0 1 n = 449 c2 = 0 1 0 n = 449 c2 = 0 1 0 4 n = 49 c2 = 0 1 0 4 0 n = 49 c2 = 0 1 0 4 0 2 n = 9 c2 = 0 1 0 4 0 2 0 n = 9 c2 = 0 1 0 4 0 2 0 1 n = 4 c2 = 0 1 0 4 0 2 0 1 2 n = 0 c2 = 0 1 0 4 0 2 0 1 2 0 n = 0 y = 1000 100 20 5 2 1 4 2 1 2 out = 1000 100 20 5 2 1 4 2 1 2