Cody

Problem 45171. Squares in Squares - Concentric Squares

Solution 2027302

Submitted on 19 Nov 2019 by Athi
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 = 7; S_correct = ... [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]; Sn_correct = 2; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));

2   Pass
n = 2; S_correct = [1 1; 1 1]; Sn_correct = 1; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));

3   Pass
n = 1; S_correct = 1; Sn_correct = 1; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));

4   Pass
n = 10; Sn_correct = 3; [~,Sn] = squaresinsquares(n); assert(isequal(Sn,Sn_correct));

5   Pass
n = 6; S_correct = ... [1 1 1 1 1 1; 1 0 0 0 0 1; 1 0 1 1 0 1; 1 0 1 1 0 1; 1 0 0 0 0 1; 1 1 1 1 1 1]; Sn_correct = 2; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}