Cody

Problem 18. Bullseye Matrix

Solution 2587324

Submitted on 20 Jun 2020 by Abdelfatah Teamah
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 = [3 3 3 3 3; 3 2 2 2 3; 3 2 1 2 3; 3 2 2 2 3; 3 3 3 3 3]; assert(isequal(bullseye(n),a));

x = 2 y = 2 x = 2 y = 3 x = 2 y = 4 x = 3 y = 2 x = 3 y = 3 x = 3 y = 4 x = 4 y = 2 x = 4 y = 3 x = 4 y = 4 x = 1 y = 1 x = 1 y = 2 x = 1 y = 3 x = 1 y = 4 x = 1 y = 5 x = 2 y = 1 x = 2 y = 2 x = 2 y = 3 x = 2 y = 4 x = 2 y = 5 x = 3 y = 1 x = 3 y = 2 x = 3 y = 3 x = 3 y = 4 x = 3 y = 5 x = 4 y = 1 x = 4 y = 2 x = 4 y = 3 x = 4 y = 4 x = 4 y = 5 x = 5 y = 1 x = 5 y = 2 x = 5 y = 3 x = 5 y = 4 x = 5 y = 5 a = 3 3 3 3 3 3 2 2 2 3 3 2 1 2 3 3 2 2 2 3 3 3 3 3 3

2   Pass
n = 7; a = [4 4 4 4 4 4 4; 4 3 3 3 3 3 4; 4 3 2 2 2 3 4; 4 3 2 1 2 3 4; 4 3 2 2 2 3 4; 4 3 3 3 3 3 4; 4 4 4 4 4 4 4]; assert(isequal(bullseye(n),a))

x = 3 y = 3 x = 3 y = 4 x = 3 y = 5 x = 4 y = 3 x = 4 y = 4 x = 4 y = 5 x = 5 y = 3 x = 5 y = 4 x = 5 y = 5 x = 2 y = 2 x = 2 y = 3 x = 2 y = 4 x = 2 y = 5 x = 2 y = 6 x = 3 y = 2 x = 3 y = 3 x = 3 y = 4 x = 3 y = 5 x = 3 y = 6 x = 4 y = 2 x = 4 y = 3 x = 4 y = 4 x = 4 y = 5 x = 4 y = 6 x = 5 y = 2 x = 5 y = 3 x = 5 y = 4 x = 5 y = 5 x = 5 y = 6 x = 6 y = 2 x = 6 y = 3 x = 6 y = 4 x = 6 y = 5 x = 6 y = 6 x = 1 y = 1 x = 1 y = 2 x = 1 y = 3 x = 1 y = 4 x = 1 y = 5 x = 1 y = 6 x = 1 y = 7 x = 2 y = 1 x = 2 y = 2 x = 2 y = 3 x = 2 y = 4 x = 2 y = 5 x = 2 y = 6 x = 2 y = 7 x = 3 y = 1 x = 3 y = 2 x = 3 y = 3 x = 3 y = 4 x = 3 y = 5 x = 3 y = 6 x = 3 y = 7 x = 4 y = 1 x = 4 y = 2 x = 4 y = 3 x = 4 y = 4 x = 4 y = 5 x = 4 y = 6 x = 4 y = 7 x = 5 y = 1 x = 5 y = 2 x = 5 y = 3 x = 5 y = 4 x = 5 y = 5 x = 5 y = 6 x = 5 y = 7 x = 6 y = 1 x = 6 y = 2 x = 6 y = 3 x = 6 y = 4 x = 6 y = 5 x = 6 y = 6 x = 6 y = 7 x = 7 y = 1 x = 7 y = 2 x = 7 y = 3 x = 7 y = 4 x = 7 y = 5 x = 7 y = 6 x = 7 y = 7 a = 4 4 4 4 4 4 4 4 3 3 3 3 3 4 4 3 2 2 2 3 4 4 3 2 1 2 3 4 4 3 2 2 2 3 4 4 3 3 3 3 3 4 4 4 4 4 4 4 4

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!