Cody

Problem 1388. Numbered lottery balls into cells

Solution 2931496

Submitted on 10 Sep 2020
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
assert(isequal(lottery(4,2),7))

2   Fail
assert(isequal(lottery(6,3),90))

Assertion failed.

3   Fail
assert(isequal(lottery(8,6),266))

Assertion failed.

4   Fail
assert(isequal(lottery(10,4),34105))

Assertion failed.

5   Fail
assert(isequal(lottery(lottery(5,2),lottery(4,2)),408741333))

Assertion failed.

6   Fail
assert(isequal(lottery(18,7),197462483400))

Assertion failed.

7   Fail
x=[1 2047 86526 611501 1379400 1323652 627396 159027 22275 1705 66 1]; a=ceil(rand*12); assert(isequal(lottery(12,a),x(a)));

Assertion failed.

8   Pass
filetext = fileread('lottery.m'); assert(isempty(strfind(filetext, 'switch'))) assert(isempty(strfind(filetext, 'case'))) assert(isempty(strfind(filetext, 'if')))

Suggested Problems

More from this Author80

Community Treasure Hunt

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

Start Hunting!