Cody

# Problem 2036. Santa's Cards

Solution 369637

Submitted on 13 Dec 2013 by James
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
assignin('caller','score',30);

2   Pass
%% nc=8; c=[2 2;4 4;2 2;3 3;2 2;1 2;1 8;1 2;4 4;3 3;3 2]; m=cards(c,nc) assert(size(m,2)==nc) for i=1:size(c,1) mt=double(m==i); mtc=conv2(mt,ones(c(i,:)),'same'); assert(nnz(mtc==c(i,1)*c(i,2))==1) end assignin('caller','score',size(m,1));

ans = Filled empty space! m = 2 2 2 2 0 0 0 0 2 2 2 2 0 0 0 0 2 2 2 2 0 0 0 0 2 2 2 2 0 0 0 0 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 0 0 0 0 0 4 4 4 0 0 0 0 0 4 4 4 0 0 0 0 0 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 0 0 4 4 4 10 10 10 0 0 4 4 4 10 10 10 0 0 m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 0 0 4 4 4 10 10 10 0 0 4 4 4 10 10 10 0 0 7 7 7 7 7 7 7 7 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 1 1 3 3 0 0 0 0 1 1 3 3 0 0 0 0 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 1 1 3 3 5 5 0 0 1 1 3 3 5 5 0 0 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 1 1 3 3 5 5 6 6 1 1 3 3 5 5 0 0 ans = Filled empty space! m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 1 1 3 3 5 5 6 6 1 1 3 3 5 5 8 8 m = 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 2 2 2 2 9 9 9 9 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 4 4 4 10 10 10 11 11 7 7 7 7 7 7 7 7 1 1 3 3 5 5 6 6 1 1 3 3 5 5 8 8

### Community Treasure Hunt

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

Start Hunting!