Cody

Problem 1642. BULLSEYE Part 2: Reference Problem 18 BULLSEYE

Solution 1120945

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.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
n = 5; a = [1 1 1 1 1; 1 0 0 0 1; 1 0 1 0 1; 1 0 0 0 1; 1 1 1 1 1;] assert(isequal(bullseye2(n),a));

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

2   Pass
n = 7; a = [1 1 1 1 1 1 1; 1 0 0 0 0 0 1; 1 0 1 1 1 0 1; 1 0 1 0 1 0 1; 1 0 1 1 1 0 1; 1 0 0 0 0 0 1; 1 1 1 1 1 1 1]; assert(isequal(bullseye2(n),a));

mid = 4 rainbow = 1 2 3 4 3 2 1 1 2 3 4 3 2 1 1 2 3 4 3 2 1 1 2 3 4 3 2 1 1 2 3 4 3 2 1 1 2 3 4 3 2 1 1 2 3 4 3 2 1 rainbow2 = 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 3 3 3 3 3 3 3 2 2 2 2 2 2 2 1 1 1 1 1 1 1 full(:,:,1) = 1 2 3 4 3 2 1 1 2 3 4 3 2 1 1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