Cody

Solution 2390483

Submitted on 27 May 2020 by Ramesh Kumar V
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
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

varargin{1} = 43 varargin{2} = 66 varargin{3} = 55 n = 3 x = 43 66 55 a = 1 1 1 1 1 1 1 1 1 a = 1 1 0 1 1 1 1 1 1 a = 1 1 0 1 0 1 1 1 1 a = 1 1 0 1 0 1 0 1 1 b = 43 66 55 y1 = 27 16 39 y = 27 16 39

2   Pass
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

varargin{1} = 30 varargin{2} = 40 varargin{3} = 50 n = 3 x = 30 40 50 a = 1 1 1 1 1 1 1 1 1 a = 1 1 0 1 1 1 1 1 1 a = 1 1 0 1 0 1 1 1 1 a = 1 1 0 1 0 1 0 1 1 b = 30 40 50 y1 = 10 20 30 y = 10 20 30

3   Pass
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

varargin{1} = 72 varargin{2} = 66 varargin{3} = 70 varargin{4} = 77 n = 4 x = 72 66 70 77 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 b = 72 66 70 77 y1 = 18 25 29 23 y = 18 25 29 23

4   Pass
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

varargin{1} = 66 varargin{2} = 67 varargin{3} = 68 varargin{4} = 69 n = 4 x = 66 67 68 69 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 b = 66 67 68 69 y1 = 21 22 23 24 y = 21 22 23 24

5   Pass
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

varargin{1} = 60 varargin{2} = 65 varargin{3} = 70 varargin{4} = 75 n = 4 x = 60 65 70 75 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 a = 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 b = 60 65 70 75 y1 = 15 20 25 30 y = 15 20 25 30

6   Pass
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

varargin{1} = 90 varargin{2} = 115 varargin{3} = 100 varargin{4} = 110 varargin{5} = 105 n = 5 x = 90 115 100 110 105 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 b = 90 115 100 110 105 y1 = 25 20 30 15 40 y = 25 20 30 15 40

7   Pass
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

varargin{1} = 44 varargin{2} = 37 varargin{3} = 47 varargin{4} = 51 varargin{5} = 53 n = 5 x = 44 37 47 51 53 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 a = 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 b = 44 37 47 51 53 y1 = 5 7 11 21 14 y = 5 7 11 21 14

8   Pass
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

varargin{1} = 133 varargin{2} = 186 varargin{3} = 172 varargin{4} = 163 varargin{5} = 192 varargin{6} = 200 varargin{7} = 184 n = 7 x = 133 186 172 163 192 200 184 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 a = 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 b = 133 186 172 163 192 200 184 y1 = 21 5 13 42 33 19 72 y = 21 5 13 42 33 19 72