Cody

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

Solution 2085075

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

binYear = '11101011001' B = logical 1 binYear = '11101010111' binYear = '11101110111' ans = 30

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

binYear = '11111011110' B = logical 0 binYear = '11111011111' ans = 1

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

binYear = '11111011111' B = logical 0 binYear = '11111011111' ans = 0

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

binYear = '1001011110' B = logical 1 binYear = '1001001001' binYear = '1001101001' ans = 11

Assertion failed.

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

binYear = '1011101110110' B = logical 1 binYear = '1011101011101' binYear = '1011101011101' ans = -25

Assertion failed.

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

binYear = '1110101001100110' B = logical 1 binYear = '1110101001010111' binYear = '1110101101010111' ans = 241

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))

binYear = '100' B = logical 0 binYear = '101' ans = 1 binYear = '110' B = logical 0 binYear = '111' ans = 1 binYear = '1010' B = logical 1 binYear = '1001' binYear = '1101' ans = 3 binYear = '10010' B = logical 1 binYear = '10001' binYear = '10101' ans = 3 binYear = '100010' B = logical 1 binYear = '100001' binYear = '101001' ans = 7 binYear = '1000010' B = logical 1 binYear = '1000001' binYear = '1001001' ans = 7 binYear = '10000010' B = logical 1 binYear = '10000001' binYear = '10010001' ans = 15 binYear = '100000010' B = logical 1 binYear = '100000001' binYear = '100010001' ans = 15 binYear = '1000000010' B = logical 1 binYear = '1000000001' binYear = '1000100001' ans = 31 binYear = '10000000010' B = logical 1 binYear = '10000000001' binYear = '10000100001' ans = 31 binYear = '100000000010' B = logical 1 binYear = '100000000001' binYear = '100001000001' ans = 63 binYear = '1000000000010' B = logical 1 binYear = '1000000000001' binYear = '1000001000001' ans = 63 binYear = '10000000000010' B = logical 1 binYear = '10000000000001' binYear = '10000010000001' ans = 127 binYear = '100000000000010' B = logical 1 binYear = '100000000000001' binYear = '100000010000001' ans = 127 binYear = '1000000000000010' B = logical 1 binYear = '1000000000000001' binYear = '1000000100000001' ans = 255

Assertion failed.