Cody

# Problem 2028. Magic Concentric Circles

Solution 3223373

Submitted on 15 Oct 2020
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   Fail
c=[ 20 33 12 4 ; 16 1 31 21 ; 23 13 19 4 ; 10 22 7 30 ; 9 9 9 9 ; 2 18 25 34 ; 29 26 11 3 ; 32 17 5 15 ; 6 8 28 27 ]; y_correct = 0; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test1 (line 11) assert(isequal(ismagic0(c),y_correct))

2   Fail
c=[ 20 33 12 4 ; 16 1 31 21 ; 23 13 19 14 ; 10 22 7 30 ; 9 9 9 9 ; 2 18 25 24 ; 29 26 11 3 ; 32 17 5 15 ; 6 8 28 27 ]; y_correct = 1; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test2 (line 11) assert(isequal(ismagic0(c),y_correct))

3   Fail
c=[24 10 23 16; 25 22 13 1; 18 7 19 31; 2 30 14 21; 9 9 9 9; 4 6 32 29; 12 8 17 26; 33 28 5 11; 20 27 15 3]; y_correct = 1; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test3 (line 11) assert(isequal(ismagic0(c),y_correct))

4   Fail
c=[ 30 29 2 32; 7 18 26 17; 22 25 11 5; 10 24 3 15; 9 9 9 9; 27 20 16 23; 28 33 1 13; 8 12 31 19; 6 4 21 14]; y_correct = 0; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test4 (line 11) assert(isequal(ismagic0(c),y_correct))

5   Fail
c=[30 2 29 32; 7 18 26 17; 22 25 11 5; 10 24 16 15; 9 9 9 9; 27 20 3 23; 28 33 1 13; 8 12 31 19; 6 4 21 14]; y_correct = 1; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test5 (line 11) assert(isequal(ismagic0(c),y_correct))

6   Fail
c=[30 2 29 32; 7 18 26 17; 22 25 11 5; 10 24 3 15; 9 9 9 9; 27 20 16 23; 28 33 1 13; 8 12 31 19; 6 4 21 14]; y_correct = 1; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test6 (line 11) assert(isequal(ismagic0(c),y_correct))

7   Pass
c=[ 30 2 29 32; 22 25 11 4; 7 18 26 17; 9 23 2 15; 8 9 9 10; 28 21 17 23; 8 12 31 19; 29 33 1 13; 6 4 21 14]; y_correct = 0; assert(isequal(ismagic0(c),y_correct))

8   Fail
c=[ 20 34 11 4 ; 16 0 31 21 ; 23 13 19 14 ; 10 22 7 30 ; 9 9 9 9 ; 2 18 25 24 ; 29 26 11 3 ; 32 17 6 15 ; 6 8 28 27 ]; y_correct = 0; assert(isequal(ismagic0(c),y_correct))

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in ismagic0 (line 11) pr2 = sum(d(size(c)/2+1:end,:)); Error in Test8 (line 11) assert(isequal(ismagic0(c),y_correct))

9   Pass
c=randi(32,9,4); y_correct = 0; assert(isequal(ismagic0(c),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!