Cody

Problem 42385. Combined Ages 4 - Non-symmetric with multiples, n ≥ 3

Solution 3388153

Submitted on 26 Oct 2020
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   Fail
ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

[Warning: Matrix is singular to working precision.] [> In combined_ages_nonsymmetric_w_mult (line 12) In ScoringEngineTestPoint1 (line 5) In solutionTest (line 3)]

Assertion failed.

2   Fail
ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

[Warning: Matrix is singular to working precision.] [> In combined_ages_nonsymmetric_w_mult (line 12) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)]

Assertion failed.

3   Fail
ABCDA = 150; ABCB = 99; BCDB = 91; ABDAD = 135; y = combined_ages_nonsymmetric_w_mult(ABCDA,ABCB,BCDB,ABDAD); y_correct = [35;11;42;27]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Assertion failed.

4   Fail
ABBA = 90; BCC = 113; ABCBA = 141; y = combined_ages_nonsymmetric_w_mult(ABBA,BCC,ABCBA); y_correct = [34;11;51]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Assertion failed.

5   Pass
ABCDE = 120; ABCDD = 111; ABCCC = 87; ABBBB = 66; AAAAA = 50; y = combined_ages_nonsymmetric_w_mult(ABCDE,ABCDD,ABCCC,ABBBB,AAAAA); y_correct = [10,14,21,33,42]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

6   Fail
ABC = 45; BEA = 66; CAE = 73; DAB = 57; AAD = 53; y = combined_ages_nonsymmetric_w_mult(ABC,BEA,CAE,DAB,AAD); y_correct = [10,14,21,33,42]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

[Warning: Matrix is singular to working precision.] [> In combined_ages_nonsymmetric_w_mult (line 12) In ScoringEngineTestPoint6 (line 6) In solutionTest (line 13)]

Assertion failed.

7   Fail
ABCABC = 144; BEAB = 107; CAEAD = 147; DABB = 73; AADAA = 133; y = combined_ages_nonsymmetric_w_mult(ABCABC,BEAB,CAEAD,DABB,AADAA); y_correct = [30,15,27,13,47]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

[Warning: Matrix is singular to working precision.] [> In combined_ages_nonsymmetric_w_mult (line 12) In ScoringEngineTestPoint7 (line 6) In solutionTest (line 15)]

Assertion failed.

8   Fail
ind = randi(4); switch ind case 1 ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; case 2 ABCDA = 150; ABCB = 99; BCDB = 91; ABDAD = 135; y = combined_ages_nonsymmetric_w_mult(ABCDA,ABCB,BCDB,ABDAD); y_correct = [35;11;42;27]; case 3 ABCABC = 144; BEAB = 107; CAEAD = 147; DABB = 73; AADAA = 133; y = combined_ages_nonsymmetric_w_mult(ABCABC,BEAB,CAEAD,DABB,AADAA); y_correct = [30,15,27,13,47]; case 4 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

[Warning: Matrix is singular to working precision.] [> In combined_ages_nonsymmetric_w_mult (line 12) In ScoringEngineTestPoint8 (line 7) In solutionTest (line 17)]

Assertion failed.

9   Fail
ind = randi(4); switch ind case 1 ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; case 2 ABCABC = 144; BEAB = 107; CAEAD = 147; DABB = 73; AADAA = 133; y = combined_ages_nonsymmetric_w_mult(ABCABC,BEAB,CAEAD,DABB,AADAA); y_correct = [30,15,27,13,47]; case 3 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 4 ABC = 45; BEA = 66; CAE = 73; DAB = 57; AAD = 53; y = combined_ages_nonsymmetric_w_mult(ABC,BEA,CAE,DAB,AAD); y_correct = [10,14,21,33,42]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

[Warning: Matrix is singular to working precision.] [> In combined_ages_nonsymmetric_w_mult (line 12) In ScoringEngineTestPoint9 (line 22) In solutionTest (line 19)]

Assertion failed.

10   Fail
ind = randi(4); switch ind case 1 ABBA = 90; BCC = 113; ABCBA = 141; y = combined_ages_nonsymmetric_w_mult(ABBA,BCC,ABCBA); y_correct = [34;11;51]; case 2 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 3 ABCDA = 150; ABCB = 99; BCDB = 91; ABDAD = 135; y = combined_ages_nonsymmetric_w_mult(ABCDA,ABCB,BCDB,ABDAD); y_correct = [35;11;42;27]; case 4 ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Assertion failed.

Suggested Problems

More from this Author139

Community Treasure Hunt

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

Start Hunting!