Cody

Solution 1691347

Submitted on 12 Dec 2018 by Martin C.
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 = 1; y = 1; assert(isequal(ResultMatrix(n),y))

y = 1 y = 1

2   Pass
n = 3; y =[9 6 3; 6 4 2; 3 2 1]; assert(isequal(ResultMatrix(n),y))

y = 3 2 1 3 2 1 3 2 1 y = 9 6 3 6 4 2 3 2 1

3   Pass
n = 4; y =[16 12 8 4; 12 9 6 3; 8 6 4 2; 4 3 2 1]; assert(isequal(ResultMatrix(n),y))

y = 4 3 2 1 4 3 2 1 4 3 2 1 4 3 2 1 y = 16 12 8 4 12 9 6 3 8 6 4 2 4 3 2 1

4   Pass
n = 5; y =[25 20 15 10 5; 20 16 12 8 4; 15 12 9 6 3; 10 8 6 4 2; 5 4 3 2 1]; assert(isequal(ResultMatrix(n),y))

y = 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 y = 25 20 15 10 5 20 16 12 8 4 15 12 9 6 3 10 8 6 4 2 5 4 3 2 1

5   Pass
n = 7; y=[49 42 35 28 21 14 7 42 36 30 24 18 12 6 35 30 25 20 15 10 5 28 24 20 16 12 8 4 21 18 15 12 9 6 3 14 12 10 8 6 4 2 7 6 5 4 3 2 1]; assert(isequal(ResultMatrix(n),y))

y = 7 6 5 4 3 2 1 7 6 5 4 3 2 1 7 6 5 4 3 2 1 7 6 5 4 3 2 1 7 6 5 4 3 2 1 7 6 5 4 3 2 1 7 6 5 4 3 2 1 y = 49 42 35 28 21 14 7 42 36 30 24 18 12 6 35 30 25 20 15 10 5 28 24 20 16 12 8 4 21 18 15 12 9 6 3 14 12 10 8 6 4 2 7 6 5 4 3 2 1

6   Pass
n = 10; y=[100 90 80 70 60 50 40 30 20 10; 90 81 72 63 54 45 36 27 18 9; 80 72 64 56 48 40 32 24 16 8; 70 63 56 49 42 35 28 21 14 7; 60 54 48 42 36 30 24 18 12 6; 50 45 40 35 30 25 20 15 10 5; 40 36 32 28 24 20 16 12 8 4; 30 27 24 21 18 15 12 9 6 3; 20 18 16 14 12 10 8 6 4 2; 10 9 8 7 6 5 4 3 2 1]; assert(isequal(ResultMatrix(n),y))

y = 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 y = 100 90 80 70 60 50 40 30 20 10 90 81 72 63 54 45 36 27 18 9 80 72 64 56 48 40 32 24 16 8 70 63 56 49 42 35 28 21 14 7 60 54 48 42 36 30 24 18 12 6 50 45 40 35 30 25 20 15 10 5 40 36 32 28 24 20 16 12 8 4 30 27 24 21 18 15 12 9 6 3 20 18 16 14 12 10 8 6 4 2 10 9 8 7 6 5 4 3 2 1