Cody

Problem 44719. Penny Distribution Machine

Solution 2064621

Submitted on 20 Dec 2019
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))

box = 1 itr = 0

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test2 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test3 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test4 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test5 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test6 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test7 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test8 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test9 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test10 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test11 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test12 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test13 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test14 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test15 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test16 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test17 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test18 (line 2) [box, itr] = PDMachine(N);

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

Unrecognized function or variable 'pos'. Error in PDMachine (line 7) r = mod(li(pos),2) Error in Test19 (line 2) [box, itr] = PDMachine(N);