Cody

Solution 2064622

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

box = 1 itr = 0

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

r = 0 box = 2 itr = 1

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

r = 1 box = 2 itr = 1

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

r = 1 r = 0 box = 3 itr = 3

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

r = 0 r = 1 r = 0 box = 4 itr = 8

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

r = 1 r = 1 r = 0 r = 0 box = 5 itr = 16

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

r = 1 r = 0 r = 0 r = 1 box = 5 itr = 22

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

r = 0 r = 1 r = 0 r = 0 r = 1 box = 6 itr = 47

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

r = 0 r = 0 r = 1 r = 0 r = 0 r = 1 box = 7 itr = 97

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

r = 1 r = 0 r = 0 r = 1 r = 0 r = 0 r = 0 r = 0 r = 1 box = 10 itr = 773

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

r = 0 r = 1 r = 0 r = 0 r = 1 r = 0 r = 1 r = 1 r = 0 r = 0 box = 11 itr = 1229

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

r = 0 r = 0 r = 0 r = 1 r = 0 r = 0 r = 0 r = 1 r = 1 r = 1 r = 0 r = 0 box = 13 itr = 4995

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

r = 1 r = 1 r = 1 r = 1 r = 0 r = 0 r = 0 r = 0 r = 1 r = 1 r = 1 r = 0 r = 0 box = 14 itr = 9991

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

r = 0 r = 0 r = 0 r = 0 r = 0 r = 1 r = 0 r = 1 r = 0 r = 1 r = 1 r = 0 r = 0 r = 0 r = 0 r = 1 box = 17 itr = 99994

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

r = 1 r = 1 r = 1 r = 0 r = 0 r = 0 r = 0 r = 1 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 0 box = 21 itr = 1234556

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

r = 0 r = 1 r = 1 r = 1 r = 0 r = 0 r = 1 r = 0 r = 1 r = 0 r = 0 r = 0 r = 0 r = 1 r = 1 r = 0 r = 0 r = 0 r = 1 r = 1 r = 1 r = 1 r = 0 box = 24 itr = 12345666

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

r = 1 r = 0 r = 0 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 0 r = 0 r = 1 r = 0 r = 1 r = 1 r = 0 r = 0 r = 1 r = 1 r = 1 r = 1 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 1 r = 1 box = 30 itr = 987654304

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

r = 0 r = 1 r = 0 r = 0 r = 1 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 0 r = 0 r = 0 r = 0 r = 0 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 0 r = 1 r = 1 r = 0 r = 0 r = 1 r = 0 r = 0 box = 31 itr = 1.2346e+09

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

r = 0 r = 1 r = 0 r = 1 r = 0 r = 1 r = 1 r = 1 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 0 r = 0 r = 0 r = 0 r = 0 r = 0 r = 1 r = 1 r = 0 r = 1 r = 0 r = 0 r = 1 r = 1 r = 0 r = 0 r = 1 r = 0 r = 0 box = 34 itr = 9.8765e+09