Cody

Solution 2088285

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

b = '11101011001' b2 = '11101010111' y = -2

Assertion failed.

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

b = '11111011110' b2 = '11111011111' y = 1

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

b = '11111011111' b2 = '11111011111' y = 0

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

b = '1001011110' b2 = '10010001001' y = 555

Assertion failed.

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

b = '1011101110110' b2 = '1011101011101' y = -25

Assertion failed.

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

b = '1110101001100110' b2 = '11101010001010111' y = 59889

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

b = '100' b2 = '101' y = 1 b = '110' b2 = '111' y = 1 b = '1010' b2 = '10001' y = 7 b = '10010' b2 = '10001' y = -1 b = '100010' b2 = '1000001' y = 31 b = '1000010' b2 = '1000001' y = -1 b = '10000010' b2 = '100000001' y = 127 b = '100000010' b2 = '100000001' y = -1 b = '1000000010' b2 = '10000000001' y = 511 b = '10000000010' b2 = '10000000001' y = -1 b = '100000000010' b2 = '1000000000001' y = 2047 b = '1000000000010' b2 = '1000000000001' y = -1 b = '10000000000010' b2 = '100000000000001' y = 8191 b = '100000000000010' b2 = '100000000000001' y = -1 b = '1000000000000010' b2 = '10000000000000001' y = 32767

Assertion failed.