Cody

# Problem 44719. Penny Distribution Machine

Solution 2042167

Submitted on 2 Dec 2019 by cokakola
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
N = 1; [box, itr] = PDMachine(N); assert(isequal(box,1) & isequal(itr,0))

2   Pass
N = 2; [box, itr] = PDMachine(N); assert(isequal(box,2) & isequal(itr,1))

3   Pass
N = 3; [box, itr] = PDMachine(N); assert(isequal(box,2) & isequal(itr,1))

4   Pass
N = 5; [box, itr] = PDMachine(N); assert(isequal(box,3) & isequal(itr,3))

5   Pass
N = 10; [box, itr] = PDMachine(N); assert(isequal(box,4) & isequal(itr,8))

6   Pass
N = 19; [box, itr] = PDMachine(N); assert(isequal(box,5) & isequal(itr,16))

7   Pass
N = 25; [box, itr] = PDMachine(N); assert(isequal(box,5) & isequal(itr,22))

8   Pass
N = 50; [box, itr] = PDMachine(N); assert(isequal(box,6) & isequal(itr,47))

9   Pass
N = 100; [box, itr] = PDMachine(N); assert(isequal(box,7) & isequal(itr,97))

10   Pass
N = 777; [box, itr] = PDMachine(N); assert(isequal(box,10) & isequal(itr,773))

11   Pass
N = 1234; [box, itr] = PDMachine(N); assert(isequal(box,11) & isequal(itr,1229))

12   Pass
N = 5000; [box, itr] = PDMachine(N); assert(isequal(box,13) & isequal(itr,4995))

13   Pass
N = 9999; [box, itr] = PDMachine(N); assert(isequal(box,14) & isequal(itr,9991))

14   Pass
N = 100000; [box, itr] = PDMachine(N); assert(isequal(box,17) & isequal(itr,99994))

15   Pass
N = 1234567; [box, itr] = PDMachine(N); assert(isequal(box,21) & isequal(itr,1234556))

16   Pass
N = 12345678; [box, itr] = PDMachine(N); assert(isequal(box,24) & isequal(itr,12345666))

17   Pass
N = 987654321; [box, itr] = PDMachine(N); assert(isequal(box,30) & isequal(itr,987654304))

18   Pass
N = 1234567890; [box, itr] = PDMachine(N); assert(isequal(box,31) & isequal(itr,1234567878))

19   Pass
N = 9876543210; [box, itr] = PDMachine(N); assert(isequal(box,34) & isequal(itr,9876543195))

### Community Treasure Hunt

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

Start Hunting!