Cody

Solution 1083451

Submitted on 17 Dec 2016 by Kensuke Fujita
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
m = magic(5); n = ones(2,3); o = [2 3]; y_correct = [7,14,16;13,20,22]; assert(isequal(cookiecutter(m,n,o),y_correct))

a = 2 b = 3 y = 7 y = 7 14 y = 7 14 16 y = 7 14 16 13 0 0 y = 7 14 16 13 20 0 y = 7 14 16 13 20 22

2   Pass
m = 1; n = 8; o = [1 1]; y_correct = 8; assert(isequal(cookiecutter(m,n,o),y_correct))

a = 1 b = 1 y = 8

3   Pass
m = magic(20); n = ones(3); o = [17 17]; y_correct = [64,338,339;357,43,42;377,23,22]; assert(isequal(cookiecutter(m,n,o),y_correct))

a = 3 b = 3 y = 64 y = 64 338 y = 64 338 339 y = 64 338 339 357 0 0 y = 64 338 339 357 43 0 y = 64 338 339 357 43 42 y = 64 338 339 357 43 42 377 0 0 y = 64 338 339 357 43 42 377 23 0 y = 64 338 339 357 43 42 377 23 22

4   Pass
m = magic(20); n = 5.*ones(2,3); o = [4 10]; y_correct = [350,355,1645;450,455,1545]; assert(isequal(cookiecutter(m,n,o),y_correct))

a = 2 b = 3 y = 350 y = 350 355 y = 350 355 1645 y = 350 355 1645 450 0 0 y = 350 355 1645 450 455 0 y = 350 355 1645 450 455 1545

5   Pass
m = magic(7); m=m(:,1:end-1); n = spiral(3); o = [5 4]; y_correct = [231,336,396;246,43,6;245,8,33]; assert(isequal(cookiecutter(m,n,o),y_correct))

a = 3 b = 3 y = 231 y = 231 336 y = 231 336 396 y = 231 336 396 246 0 0 y = 231 336 396 246 43 0 y = 231 336 396 246 43 6 y = 231 336 396 246 43 6 245 0 0 y = 231 336 396 246 43 6 245 8 0 y = 231 336 396 246 43 6 245 8 33