Cody

Solution 702293

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

x = 35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11 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 ans = []

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

x = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55 57 64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42 49 26 33 65 23 5 82 89 91 48 30 32 39 66 79 6 13 95 97 29 31 38 45 72 10 12 94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59 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 ans = []

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

x = 68 81 94 107 120 1 14 27 40 53 66 80 93 106 119 11 13 26 39 52 65 67 92 105 118 10 12 25 38 51 64 77 79 104 117 9 22 24 37 50 63 76 78 91 116 8 21 23 36 49 62 75 88 90 103 7 20 33 35 48 61 74 87 89 102 115 19 32 34 47 60 73 86 99 101 114 6 31 44 46 59 72 85 98 100 113 5 18 43 45 58 71 84 97 110 112 4 17 30 55 57 70 83 96 109 111 3 16 29 42 56 69 82 95 108 121 2 15 28 41 54 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 ans = []

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

x = 1 2 3 4 4 6 2 8 9 m = 3 n = 3 y = 0 0 2 y = 0 4 2 y = 3 4 2 y = 9 ans = []

Suggested Problems

More from this Author1