Cody

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

Solution 3823818

Submitted on 24 Nov 2020 by Summer Brown
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

sol = 1 0 0 27 0 1 0 16 0 0 1 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

sol = 1 0 0 10 0 1 0 20 0 0 1 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

sol = 1 0 0 5 0 1 0 15 0 0 1 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

sol = 1 0 0 3 0 1 0 31 0 0 1 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

sol = 1 0 0 2 0 1 0 11 0 0 1 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

sol = 1 0 0 11 0 1 0 17 0 0 1 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

sol = 1 0 0 15 0 1 0 35 0 0 1 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!