Cody

# Problem 42384. Combined Ages 2 - Symmetric, n ≥ 3

Solution 2122990

Submitted on 9 Feb 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
AB = 43; AC = 66; BC = 55; y = combined_ages2(AB,AC,BC); y_correct = [27 16 39]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test1 (line 4) y = combined_ages2(AB,AC,BC);

2   Fail
AB = 30; AC = 40; BC = 50; y = combined_ages2(AB,AC,BC); y_correct = [10 20 30]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test2 (line 4) y = combined_ages2(AB,AC,BC);

3   Fail
ABC = 72; ABD = 66; ACD = 70; BCD = 77; y = combined_ages2(ABC,ABD,ACD,BCD); y_correct = [18 25 29 23]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test3 (line 5) y = combined_ages2(ABC,ABD,ACD,BCD);

4   Fail
ABC = 66; ABD = 67; ACD = 68; BCD = 69; y = combined_ages2(ABC,ABD,ACD,BCD); y_correct = [21 22 23 24]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test4 (line 5) y = combined_ages2(ABC,ABD,ACD,BCD);

5   Fail
ABC = 60; ABD = 65; ACD = 70; BCD = 75; y = combined_ages2(ABC,ABD,ACD,BCD); y_correct = [15 20 25 30]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test5 (line 5) y = combined_ages2(ABC,ABD,ACD,BCD);

6   Fail
ABCD = 90; ABCE = 115; ABDE = 100; ACDE = 110; BCDE = 105; y = combined_ages2(ABCD,ABCE,ABDE,ACDE,BCDE); y_correct = [25 20 30 15 40]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test6 (line 6) y = combined_ages2(ABCD,ABCE,ABDE,ACDE,BCDE);

7   Fail
ABCD = 44; ABCE = 37; ABDE = 47; ACDE = 51; BCDE = 53; y = combined_ages2(ABCD,ABCE,ABDE,ACDE,BCDE); y_correct = [5 7 11 21 14]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test7 (line 6) y = combined_ages2(ABCD,ABCE,ABDE,ACDE,BCDE);

8   Fail
ABCDEF = 133; ABCDEG = 186; ABCDFG = 172; ABCEFG = 163; ABDEFG = 192; ACDEFG = 200; BCDEFG = 184; y = combined_ages2(ABCDEF,ABCDEG,ABCDFG,ABCEFG,ABDEFG,ACDEFG,BCDEFG); y_correct = [21 5 13 42 33 19 72]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Error using \ Matrix dimensions must agree. Error in combined_ages2 (line 2) ([1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1]\cell2mat(varargin))' Error in Test8 (line 8) y = combined_ages2(ABCDEF,ABCDEG,ABCDFG,ABCEFG,ABDEFG,ACDEFG,BCDEFG);