Cody

Solution 1768651

Submitted on 1 Apr 2019 by Albit
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 = 5; a = [1 0 1 0 1; 0 1 0 1 0; 1 0 1 0 1; 0 1 0 1 0; 1 0 1 0 1]; assert(isequal(a,checkerboard(n)))

x = 5 h = 25 -300 1050 -1400 630 -300 4800 -18900 26880 -12600 1050 -18900 79380 -117600 56700 -1400 26880 -117600 179200 -88200 630 -12600 56700 -88200 44100 a = 5×5 logical array 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

2   Pass
n = 4; a = [1 0 1 0; 0 1 0 1; 1 0 1 0; 0 1 0 1]; assert(isequal(a,checkerboard(n)))

x = 4 h = 16 -120 240 -140 -120 1200 -2700 1680 240 -2700 6480 -4200 -140 1680 -4200 2800 a = 4×4 logical array 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1

3   Pass
n = 7; a = [1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1]; assert(isequal(a,checkerboard(n)))

x = 7 h = 49 -1176 8820 -29400 48510 -38808 12012 -1176 37632 -317520 1128960 -1940400 1596672 -504504 8820 -317520 2857680 -10584000 18711000 -15717240 5045040 -29400 1128960 -10584000 40320000 -72765000 62092800 -20180160 48510 -1940400 18711000 -72765000 133402500 -115259760 37837800 -38808 1596672 -15717240 62092800 -115259760 100590336 -33297264 12012 -504504 5045040 -20180160 37837800 -33297264 11099088 a = 7×7 logical array 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Suggested Problems

More from this Author95