Cody

Problem 42382. Combined Ages 1 - Symmetric, n = 3

Solution 2032851

Submitted on 23 Nov 2019 by Hung Trinh
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; BC = 55; AC = 66; y = combined_ages(AB,BC,AC); y_correct = [27 16 39]; for i = 1:3 assert(isequal(y(i),y_correct(i))) end

b = 16 a = 27 c = 39

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

b = 20 a = 10 c = 30

3   Pass
AB = 20; BC = 70; AC = 60; y = combined_ages(AB,BC,AC); y_correct = [5 15 55]; for i = 1:3 assert(isequal(y(i),y_correct(i))) end

b = 15 a = 5 c = 55

4   Pass
AB = 34; BC = 84; AC = 56; y = combined_ages(AB,BC,AC); y_correct = [3 31 53]; for i = 1:3 assert(isequal(y(i),y_correct(i))) end

b = 31 a = 3 c = 53

5   Pass
y_correct = [2 11 21]; AB = y_correct(1) + y_correct(2); BC = y_correct(2) + y_correct(3); AC = y_correct(1) + y_correct(3); y = combined_ages(AB,BC,AC); for i = 1:3 assert(isequal(y(i),y_correct(i))) end

b = 11 a = 2 c = 21

6   Pass
y_correct = [11 17 21]; AB = y_correct(1) + y_correct(2); BC = y_correct(2) + y_correct(3); AC = y_correct(1) + y_correct(3); y = combined_ages(AB,BC,AC); for i = 1:3 assert(isequal(y(i),y_correct(i))) end

b = 17 a = 11 c = 21

7   Pass
y_correct = [15 35 55]; AB = y_correct(1) + y_correct(2); BC = y_correct(2) + y_correct(3); AC = y_correct(1) + y_correct(3); y = combined_ages(AB,BC,AC); for i = 1:3 assert(isequal(y(i),y_correct(i))) end

b = 35 a = 15 c = 55

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!