Cody

Problem 1287. Unique dice configurations

Solution 2158114

Submitted on 12 Mar 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(unique_dice(2,6),21))

ans = 21

2   Pass
assert(isequal(unique_dice(6,8),1716))

ans = 1716

3   Pass
assert(isequal(unique_dice(10,12),352716))

ans = 352716

4   Fail
assert(isequal(unique_dice(20,20),68923264410))

Index in position 1 exceeds array bounds (must not exceed 20). Error in unique_dice (line 3) sum(ans(1:n+1,s-1)) Error in Test4 (line 1) assert(isequal(unique_dice(20,20),68923264410))

5   Pass
assert(isequal(unique_dice(4,100),4421275))

ans = 4421275

6   Fail
assert(isequal(unique_dice(100,4),176851))

Index in position 1 exceeds array bounds (must not exceed 100). Error in unique_dice (line 3) sum(ans(1:n+1,s-1)) Error in Test6 (line 1) assert(isequal(unique_dice(100,4),176851))

7   Fail
x=ceil(10000*rand); assert(isequal(unique_dice(1,x),x))

ans = NaN

Assertion failed.