Cody

# Problem 2869. There are 10 types of people in the world

Solution 1981102

Submitted on 17 Oct 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
x = 1881;y_correct = 30; assert(isequal(yearraey(x),y_correct))

xb = 1 1 1 0 1 0 1 1 0 0 1 ans = 1×5 logical array 0 0 0 1 0 ind = 6 xb = 1 1 1 0 1 1 1 1 0 0 1 xnxt = 1 1 1 0 1 1 1 0 1 1 1 y = 30

2   Fail
x = 2014;y_correct = 1; assert(isequal(yearraey(x),y_correct))

xb = 1 1 1 1 1 0 1 1 1 1 0 ans = 1×5 logical array 0 0 0 0 0 ind = 6 xb = 1 1 1 1 1 1 1 1 1 1 0 xnxt = 1 1 1 1 1 1 1 1 1 1 1 y = 33

Assertion failed.

3   Fail
x = 2015;y_correct = 0; assert(isequal(yearraey(x),y_correct))

xb = 1 1 1 1 1 0 1 1 1 1 1 ans = 1×5 logical array 0 0 0 0 0 ind = 6 xb = 1 1 1 1 1 1 1 1 1 1 1 xnxt = 1 1 1 1 1 1 1 1 1 1 1 y = 32

Assertion failed.

4   Fail
x = 606;y_correct = 27; assert(isequal(yearraey(x),y_correct))

xb = 1 0 0 1 0 1 1 1 1 0 ans = 1×5 logical array 0 1 1 0 1 ind = 5 xb = 1 0 0 1 1 1 1 1 1 0 xnxt = 1 0 0 1 1 1 1 1 0 0 1 y = 667

Assertion failed.

5   Fail
x = 6006;y_correct = 71; assert(isequal(yearraey(x),y_correct))

xb = 1 0 1 1 1 0 1 1 1 0 1 1 0 ans = 1×5 logical array 0 1 0 0 0 ind = 6 xb = 1 0 1 1 1 1 1 1 1 0 1 1 0 xnxt = 1 0 1 1 1 1 1 1 1 0 1 y = -4473

Assertion failed.

6   Fail
x = 60006;y_correct = 369; assert(isequal(yearraey(x),y_correct))

xb = 1 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 ans = 1×5 logical array 0 0 0 1 0 ind = 6 xb = 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 xnxt = 1 1 1 0 1 1 1 0 1 1 1 y = -58095

Assertion failed.

7   Fail
k=zeros(1,15); for n=1:15 y=2^n+2; k(n)=yearraey(y); end y_correct=[1 1 5 3 11 7 23 15 47 31 95 63 191 127 383]; assert(isequal(k,y_correct))

xb = 1 0 0

Index exceeds the number of array elements (3). Error in yearraey (line 3) xb(1:5)==0 Error in Test7 (line 4) k(n)=yearraey(y);