Cody

Problem 42888. Frobenius McNugget Factorization

Solution 1635738

Submitted on 29 Sep 2018
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
nuggets = [2 5]; frob_correct = 3; assert(isequal(hungerGame(nuggets),frob_correct))

2   Fail
nuggets = [6 9 20]; frob_correct = 43; assert(isequal(hungerGame(nuggets),frob_correct))

Not enough input arguments. Error in lcm (line 15) if any(round(a(:)) ~= a(:) | round(b(:)) ~= b(:) | a(:) < 1 | b(:) < 1) Error in hungerGame (line 6) while mod(a(1),lcm(a(2:3))*gcd(a(1:3)))~=0 Error in Test2 (line 3) assert(isequal(hungerGame(nuggets),frob_correct))

3   Fail
nuggets = [17 19 32]; frob_correct = 175; assert(isequal(hungerGame(nuggets),frob_correct))

Not enough input arguments. Error in lcm (line 15) if any(round(a(:)) ~= a(:) | round(b(:)) ~= b(:) | a(:) < 1 | b(:) < 1) Error in hungerGame (line 6) while mod(a(1),lcm(a(2:3))*gcd(a(1:3)))~=0 Error in Test3 (line 3) assert(isequal(hungerGame(nuggets),frob_correct))

4   Fail
nuggets = [13 14 15]; frob_correct = 77; assert(isequal(hungerGame(nuggets),frob_correct))

Not enough input arguments. Error in lcm (line 15) if any(round(a(:)) ~= a(:) | round(b(:)) ~= b(:) | a(:) < 1 | b(:) < 1) Error in hungerGame (line 6) while mod(a(1),lcm(a(2:3))*gcd(a(1:3)))~=0 Error in Test4 (line 3) assert(isequal(hungerGame(nuggets),frob_correct))

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!