Cody

# Problem 43131. Which coins to give

Solution 2704497

Submitted on 17 Jul 2020 by Ramesh Kumar V
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
x = 0.63; y_correct = [1 0 1 0 1 1]; assert(isequal(coins(x),y_correct))

y = [] x = 0.6300 ans = 0.5000 y1 = 1 y = 1 rem1 = 0.1300 x = 0.1300 x = 0.1300 ans = 0.2000 y1 = 0 y = 1 0 rem1 = 0.1300 x = 0.1300 x = 0.1300 ans = 0.1000 y1 = 1 y = 1 0 1 rem1 = 0.0300 x = 0.0300 x = 0.0300 ans = 0.0500 y1 = 0 y = 1 0 1 0 rem1 = 0.0300 x = 0.0300 x = 0.0300 ans = 0.0200 y1 = 1 y = 1 0 1 0 1 rem1 = 0.0100 x = 0.0100 x = 0.0100 ans = 0.0100 y1 = 1 y = 1 0 1 0 1 1 rem1 = 0 x = 0

2   Pass
x = 0.49; y_correct = [0 2 0 1 2 0]; assert(isequal(coins(x),y_correct))

y = [] x = 0.4900 ans = 0.5000 y1 = 0 y = 0 rem1 = 0.4900 x = 0.4900 x = 0.4900 ans = 0.2000 y1 = 2 y = 0 2 rem1 = 0.0900 x = 0.0900 x = 0.0900 ans = 0.1000 y1 = 0 y = 0 2 0 rem1 = 0.0900 x = 0.0900 x = 0.0900 ans = 0.0500 y1 = 1 y = 0 2 0 1 rem1 = 0.0400 x = 0.0400 x = 0.0400 ans = 0.0200 y1 = 2 y = 0 2 0 1 2 rem1 = 0 x = 0 x = 0 ans = 0.0100 y1 = 0 y = 0 2 0 1 2 0 rem1 = 0 x = 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!