Cody

Solution 2027758

Submitted on 19 Nov 2019 at 15:55
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))

bx = '11101011001' lc = 5 cyb = '11001' nyb = '10111' nybh = '11101' cy = 25 ny = 23 nyh = 29 nypb = '11101110111' nyp = 1911 y = 30

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

bx = '11111011110' lc = 5 cyb = '11110' nyb = '11111' nybh = '11111' cy = 30 ny = 31 nyh = 31 y = 1

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

bx = '11111011111' lc = 5 cyb = '11111' nyb = '11111' nybh = '11111' cy = 31 ny = 31 nyh = 31 y = 0

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

bx = '1001011110' lc = 5 cyb = '11110' nyb = '01001' nybh = '10010' cy = 30 ny = 9 nyh = 18 nypb = '1001111001' nyp = 633 y = 27

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

bx = '1011101110110' lc = 6 cyb = '110110' nyb = '011101' nybh = '101110' cy = 54 ny = 29 nyh = 46 nypb = '1011111111101' nyp = 6141 y = 135

Assertion failed.

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

bx = '1110101001100110' lc = 8 cyb = '01100110' nyb = '01010111' nybh = '11101010' cy = 102 ny = 87 nyh = 234 nypb = '1110101111010111' nyp = 60375 y = 369

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

bx = '100' lc = 1 cyb = '0' nyb = '1' nybh = '1' cy = 0 ny = 1 nyh = 1 y = 1 bx = '110' lc = 1 cyb = '0' nyb = '1' nybh = '1' cy = 0 ny = 1 nyh = 1 y = 1 bx = '1010' lc = 2 cyb = '10' nyb = '01' nybh = '10' cy = 2 ny = 1 nyh = 2 nypb = '1111' nyp = 15 y = 5 bx = '10010' lc = 2 cyb = '10' nyb = '01' nybh = '10' cy = 2 ny = 1 nyh = 2 nypb = '10101' nyp = 21 y = 3 bx = '100010' lc = 3 cyb = '010' nyb = '001' nybh = '100' cy = 2 ny = 1 nyh = 4 nypb = '101101' nyp = 45 y = 11 bx = '1000010' lc = 3 cyb = '010' nyb = '001' nybh = '100' cy = 2 ny = 1 nyh = 4 nypb = '1001001' nyp = 73 y = 7 bx = '10000010' lc = 4 cyb = '0010' nyb = '0001' nybh = '1000' cy = 2 ny = 1 nyh = 8 nypb = '10011001' nyp = 153 y = 23 bx = '100000010' lc = 4 cyb = '0010' nyb = '0001' nybh = '1000' cy = 2 ny = 1 nyh = 8 nypb = '100010001' nyp = 273 y = 15 bx = '1000000010' lc = 5 cyb = '00010' nyb = '00001' nybh = '10000' cy = 2 ny = 1 nyh = 16 nypb = '1000110001' nyp = 561 y = 47 bx = '10000000010' lc = 5 cyb = '00010' nyb = '00001' nybh = '10000' cy = 2 ny = 1 nyh = 16 nypb = '10000100001' nyp = 1057 y = 31 bx = '100000000010' lc = 6 cyb = '000010' nyb = '000001' nybh = '100000' cy = 2 ny = 1 nyh = 32 nypb = '100001100001' nyp = 2145 y = 95 bx = '1000000000010' lc = 6 cyb = '000010' nyb = '000001' nybh = '100000' cy = 2 ny = 1 nyh = 32 nypb = '1000001000001' nyp = 4161 y = 63 bx = '10000000000010' lc = 7 cyb = '0000010' nyb = '0000001' nybh = '1000000' cy = 2 ny = 1 nyh = 64 nypb = '10000011000001' nyp = 8385 y = 191 bx = '100000000000010' lc = 7 cyb = '0000010' nyb = '0000001' nybh = '1000000' cy = 2 ny = 1 nyh = 64 nypb = '100000010000001' nyp = 16513 y = 127 bx = '1000000000000010' lc = 8 cyb = '00000010' nyb = '00000001' nybh = '10000000' cy = 2 ny = 1 nyh = 128 nypb = '1000000110000001' nyp = 33153 y = 383

Suggested Problems

More from this Author80