Cody

Solution 702291

Submitted on 16 Jul 2015 by Brian
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 = magic(6); y_correct = 111; assert(isequal(sum_of_sec_diag(x),y_correct))

m = 6 n = 6 y = 0 0 0 0 0 4 y = 0 0 0 0 5 4 y = 0 0 0 33 5 4 y = 0 0 22 33 5 4 y = 0 23 22 33 5 4 y = 24 23 22 33 5 4 y = 111

2   Pass
%% x = magic(10); y_correct = 505; assert(isequal(sum_of_sec_diag(x),y_correct))

m = 10 n = 10 y = 0 0 0 0 0 0 0 0 0 11 y = 0 0 0 0 0 0 0 0 12 11 y = 0 0 0 0 0 0 0 13 12 11 y = 0 0 0 0 0 0 89 13 12 11 y = 0 0 0 0 0 90 89 13 12 11 y = 0 0 0 0 61 90 89 13 12 11 y = 0 0 0 62 61 90 89 13 12 11 y = 0 0 63 62 61 90 89 13 12 11 y = 0 64 63 62 61 90 89 13 12 11 y = 40 64 63 62 61 90 89 13 12 11 y = 505

3   Pass
%% x = magic(11); y_correct = 671; assert(isequal(sum_of_sec_diag(x),y_correct))

m = 11 n = 11 y = 0 0 0 0 0 0 0 0 0 0 56 y = 0 0 0 0 0 0 0 0 0 57 56 y = 0 0 0 0 0 0 0 0 58 57 56 y = 0 0 0 0 0 0 0 59 58 57 56 y = 0 0 0 0 0 0 60 59 58 57 56 y = 0 0 0 0 0 61 60 59 58 57 56 y = 0 0 0 0 62 61 60 59 58 57 56 y = 0 0 0 63 62 61 60 59 58 57 56 y = 0 0 64 63 62 61 60 59 58 57 56 y = 0 65 64 63 62 61 60 59 58 57 56 y = 66 65 64 63 62 61 60 59 58 57 56 y = 671

4   Pass
%% x=[1 2 3; 4 4 6; 2 8 9]; y_correct = 9; assert(isequal(sum_of_sec_diag(x),y_correct))

m = 3 n = 3 y = 0 0 2 y = 0 4 2 y = 3 4 2 y = 9

More from this Author1