Cody

Problem 1643. BULLSEYE Part 3: Reference Problem 18 BULLSEYE

Solution 1120962

Submitted on 12 Feb 2017 by Jihye Sofia Seo
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 = [0 0 0 0 0; 0 69 69 69 0; 0 69 0 69 0; 0 69 69 69 0; 0 0 0 0 0]; assert(isequal(bullseye3(n),a));

mid = 2 vec = 2 1 0 1 2 vec = 2 1 0 1 2 vec = 2 1 0 1 2 rainbow = 2 1 0 1 2 2 1 0 1 2 2 1 0 1 2 2 1 0 1 2 2 1 0 1 2 rainbow2 = 2 2 2 2 2 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 full(:,:,1) = 2 1 0 1 2 2 1 0 1 2 2 1 0 1 2 2 1 0 1 2 2 1 0 1 2 full(:,:,2) = 2 2 2 2 2 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 a = 2 2 2 2 2 2 1 1 1 2 2 1 0 1 2 2 1 1 1 2 2 2 2 2 2 a = 0 0 0 0 0 0 69 69 69 0 0 69 0 69 0 0 69 69 69 0 0 0 0 0 0 a = 0 0 0 0 0 0 69 69 69 0 0 69 0 69 0 0 69 69 69 0 0 0 0 0 0

2   Pass
n = 9; a = [0 0 0 0 0 0 0 0 0; 0 69 69 69 69 69 69 69 0; 0 69 0 0 0 0 0 69 0; 0 69 0 69 69 69 0 69 0; 0 69 0 69 0 69 0 69 0; 0 69 0 69 69 69 0 69 0; 0 69 0 0 0 0 0 69 0; 0 69 69 69 69 69 69 69 0; 0 0 0 0 0 0 0 0 0;]; assert(isequal(bullseye3(n),a));

mid = 4 vec = 4 3 2 1 0 1 2 3 4 vec = 4 3 2 1 0 1 2 3 4 vec = 4 3 2 1 0 1 2 3 4 rainbow = 4 3 2 1 0 1 2 3 4 4 3 2 1 0 1 2 3 4 4 3 2 1 0 1 2 3 4 4 3 2 1 0 1 2 3 4 4 3 2 1 0 1 2 3 4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