Cody

Problem 44719. Penny Distribution Machine

Solution 2723466

Submitted on 21 Jul 2020
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   Fail
N = 2; [box, itr] = PDMachine(N); assert(isequal(box,2) & isequal(itr,1))

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.