Cody

Solution 1661098

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

2   Pass
ABC = 70; BC = 50; AC = 40; y = combined_ages_nonsymmetric(ABC,BC,AC); y_correct = [20;30;20]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

3   Pass
ABCD = 100; ABC = 80; BCD = 70; ABD = 60; y = combined_ages_nonsymmetric(ABCD,ABC,BCD,ABD); y_correct = [30;10;40;20]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

4   Pass
AB = 34; BC = 54; ABC = 86; y = combined_ages_nonsymmetric(AB,BC,ABC); y_correct = [32;2;52]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

5   Pass
ABCDE = 120; ABCD = 78; ABC = 45; AB = 24; AC = 31; y = combined_ages_nonsymmetric(ABCDE,ABCD,ABC,AB,AC); y_correct = [10,14,21,33,42]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

6   Pass
y_correct = [37 33 31 38]; ABC = y_correct(1) + y_correct(2) + y_correct(3); BCD = y_correct(2) + y_correct(3) + y_correct(4); ACD = y_correct(1) + y_correct(3) + y_correct(4); ABD = y_correct(1) + y_correct(2) + y_correct(4); y = combined_ages_nonsymmetric(ABC,BCD,ACD,ABD); for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

7   Pass
y_correct = [5 15 30 62 100]; AB = y_correct(1) + y_correct(2); BC = y_correct(2) + y_correct(3); AC = y_correct(1) + y_correct(3); ACE = y_correct(1) + y_correct(3) + y_correct(5); ABDE = y_correct(1) + y_correct(2) + y_correct(4) + y_correct(5); y = combined_ages_nonsymmetric(AB,BC,AC,ACE,ABDE); for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

8   Pass
y_correct = [2 3 5 7 11 17 23 31 42 55]; AB = y_correct(1) + y_correct(2); BC = y_correct(2) + y_correct(3); AC = y_correct(1) + y_correct(3); ABCD = y_correct(1) + y_correct(2) + y_correct(3) + y_correct(4); CDEG = y_correct(3) + y_correct(4) + y_correct(5) + y_correct(7); BFH = y_correct(2) + y_correct(6) + y_correct(8); FGIJ = y_correct(6) + y_correct(7) + y_correct(9) + y_correct(10); ACEGH = y_correct(1) + y_correct(3) + y_correct(5) + y_correct(7) + y_correct(8); BEJ = y_correct(2) + y_correct(5) + y_correct(10); ABDIJ = y_correct(1) + y_correct(2) + y_correct(4) + y_correct(9) + y_correct(10); y = combined_ages_nonsymmetric(AB,BC,AC,ABCD,CDEG,BFH,FGIJ,ACEGH,BEJ,ABDIJ); for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

9   Pass
ind = randi(4); switch ind case 1 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 2 ABCD = 100; ABC = 80; BCD = 70; ABD = 60; y = combined_ages_nonsymmetric(ABCD,ABC,BCD,ABD); y_correct = [30;10;40;20]; case 3 AB = 34; BC = 54; ABC = 86; y = combined_ages_nonsymmetric(AB,BC,ABC); y_correct = [32;2;52]; case 4 ABC = 70; BC = 50; AC = 40; y = combined_ages_nonsymmetric(ABC,BC,AC); y_correct = [20;30;20]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

10   Pass
ind = randi(4); switch ind case 1 ABC = 70; BC = 50; AC = 40; y = combined_ages_nonsymmetric(ABC,BC,AC); y_correct = [20;30;20]; case 2 AB = 34; BC = 54; ABC = 86; y = combined_ages_nonsymmetric(AB,BC,ABC); y_correct = [32;2;52]; case 3 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 4 ABCD = 100; ABC = 80; BCD = 70; ABD = 60; y = combined_ages_nonsymmetric(ABCD,ABC,BCD,ABD); y_correct = [30;10;40;20]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

11   Pass
ind = randi(4); switch ind case 1 AB = 34; BC = 54; ABC = 86; y = combined_ages_nonsymmetric(AB,BC,ABC); y_correct = [32;2;52]; case 2 ABCD = 100; ABC = 80; BCD = 70; ABD = 60; y = combined_ages_nonsymmetric(ABCD,ABC,BCD,ABD); y_correct = [30;10;40;20]; case 3 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 4 ABC = 70; BC = 50; AC = 40; y = combined_ages_nonsymmetric(ABC,BC,AC); y_correct = [20;30;20]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end