Cody

Problem 42385. Combined Ages 4 - Non-symmetric with multiples, n ≥ 3

Solution 687990

Submitted on 16 Jun 2015
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
%% ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

2   Fail
%% ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

3   Fail
%% ABCDA = 150; ABCB = 99; BCDB = 91; ABDAD = 135; y = combined_ages_nonsymmetric_w_mult(ABCDA,ABCB,BCDB,ABDAD); y_correct = [35;11;42;27]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

4   Fail
%% ABBA = 90; BCC = 113; ABCBA = 141; y = combined_ages_nonsymmetric_w_mult(ABBA,BCC,ABCBA); y_correct = [34;11;51]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

5   Fail
%% ABCDE = 120; ABCDD = 111; ABCCC = 87; ABBBB = 66; AAAAA = 50; y = combined_ages_nonsymmetric_w_mult(ABCDE,ABCDD,ABCCC,ABBBB,AAAAA); y_correct = [10,14,21,33,42]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

6   Fail
%% ABC = 45; BEA = 66; CAE = 73; DAB = 57; AAD = 53; y = combined_ages_nonsymmetric_w_mult(ABC,BEA,CAE,DAB,AAD); y_correct = [10,14,21,33,42]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

7   Fail
%% ABCABC = 144; BEAB = 107; CAEAD = 147; DABB = 73; AADAA = 133; y = combined_ages_nonsymmetric_w_mult(ABCABC,BEAB,CAEAD,DABB,AADAA); y_correct = [30,15,27,13,47]; for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

8   Fail
%% anti-cheating test case ind = randi(4); switch ind case 1 ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; case 2 ABCDA = 150; ABCB = 99; BCDB = 91; ABDAD = 135; y = combined_ages_nonsymmetric_w_mult(ABCDA,ABCB,BCDB,ABDAD); y_correct = [35;11;42;27]; case 3 ABCABC = 144; BEAB = 107; CAEAD = 147; DABB = 73; AADAA = 133; y = combined_ages_nonsymmetric_w_mult(ABCABC,BEAB,CAEAD,DABB,AADAA); y_correct = [30,15,27,13,47]; case 4 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

9   Fail
%% anti-cheating test case ind = randi(4); switch ind case 1 ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; case 2 ABCABC = 144; BEAB = 107; CAEAD = 147; DABB = 73; AADAA = 133; y = combined_ages_nonsymmetric_w_mult(ABCABC,BEAB,CAEAD,DABB,AADAA); y_correct = [30,15,27,13,47]; case 3 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 4 ABC = 45; BEA = 66; CAE = 73; DAB = 57; AAD = 53; y = combined_ages_nonsymmetric_w_mult(ABC,BEA,CAE,DAB,AAD); y_correct = [10,14,21,33,42]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

10   Fail
%% anti-cheating test case ind = randi(4); switch ind case 1 ABBA = 90; BCC = 113; ABCBA = 141; y = combined_ages_nonsymmetric_w_mult(ABBA,BCC,ABCBA); y_correct = [34;11;51]; case 2 ABCD = 70; ABC = 65; AB = 40; BC = 52; y = combined_ages_nonsymmetric_w_mult(ABCD,ABC,AB,BC); y_correct = [13;27;25;5]; case 3 ABCDA = 150; ABCB = 99; BCDB = 91; ABDAD = 135; y = combined_ages_nonsymmetric_w_mult(ABCDA,ABCB,BCDB,ABDAD); y_correct = [35;11;42;27]; case 4 ABCC = 98; BBC = 84; AAB = 70; y = combined_ages_nonsymmetric_w_mult(ABCC,BBC,AAB); y_correct = [20;30;24]; end for i = 1:numel(y_correct) assert(isequal(y(i),y_correct(i))) end

Undefined function 'accumarray' for input arguments of type 'char'.

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!