Cody

# Problem 2405. The Number of Ways

Solution 1964454

Submitted on 7 Oct 2019
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
n=2; p=2; y_correct=[ 1 3 1 4 2 3 2 4] assert(isequal(Ways(n,p),y_correct))

y_correct = 1 3 1 4 2 3 2 4

Output argument "y" (and maybe others) not assigned during call to "Ways". Error in Test1 (line 8) assert(isequal(Ways(n,p),y_correct))

2   Fail
n=3; p=5; y_correct=[ 1 4 7 10 13 1 4 7 10 14 1 4 7 10 15 1 4 7 11 13 1 4 7 11 14 1 4 7 11 15 1 4 7 12 13 1 4 7 12 14 1 4 7 12 15 1 4 8 10 13 1 4 8 10 14 1 4 8 10 15 1 4 8 11 13 1 4 8 11 14 1 4 8 11 15 1 4 8 12 13 1 4 8 12 14 1 4 8 12 15 1 4 9 10 13 1 4 9 10 14 1 4 9 10 15 1 4 9 11 13 1 4 9 11 14 1 4 9 11 15 1 4 9 12 13 1 4 9 12 14 1 4 9 12 15 1 5 7 10 13 1 5 7 10 14 1 5 7 10 15 1 5 7 11 13 1 5 7 11 14 1 5 7 11 15 1 5 7 12 13 1 5 7 12 14 1 5 7 12 15 1 5 8 10 13 1 5 8 10 14 1 5 8 10 15 1 5 8 11 13 1 5 8 11 14 1 5 8 11 15 1 5 8 12 13 1 5 8 12 14 1 5 8 12 15 1 5 9 10 13 1 5 9 10 14 1 5 9 10 15 1 5 9 11 13 1 5 9 11 14 1 5 9 11 15 1 5 9 12 13 1 5 9 12 14 1 5 9 12 15 1 6 7 10 13 1 6 7 10 14 1 6 7 10 15 1 6 7 11 13 1 6 7 11 14 1 6 7 11 15 1 6 7 12 13 1 6 7 12 14 1 6 7 12 15 1 6 8 10 13 1 6 8 10 14 1 6 8 10 15 1 6 8 11 13 1 6 8 11 14 1 6 8 11 15 1 6 8 12 13 1 6 8 12 14 1 6 8 12 15 1 6 9 10 13 1 6 9 10 14 1 6 9 10 15 1 6 9 11 13 1 6 9 11 14 1 6 9 11 15 1 6 9 12 13 1 6 9 12 14 1 6 9 12 15 2 4 7 10 13 2 4 7 10 14 2 4 7 10 15 2 4 7 11 13 2 4 7 11 14 2 4 7 11 15 2 4 7 12 13 2 4 7 12 14 2 4 7 12 15 2 4 8 10 13 2 4 8 10 14 2 4 8 10 15 2 4 8 11 13 2 4 8 11 14 2 4 8 11 15 2 4 8 12 13 2 4 8 12 14 2 4 8 12 15 2 4 9 10 13 2 4 9 10 14 2 4 9 10 15 2 4 9 11 13 2 4 9 11 14 2 4 9 11 15 2 4 9 12 13 2 4 9 12 14 2 4 9 12 15 2 5 7 10 13 2 5 7 10 14 2 5 7 10 15 2 5 7 11 13 2 5 7 11 14 2 5 7 11 15 2 5 7 12 13 2 5 7 12 14 2 5 7 12 15 2 5 8 10 13 2 5 8 10 14 2 5 8 10 15 2 5 8 11 13 2 5 8 11 14 2 5 8 11 15 2 5 8 12 13 2 5 8 12 14 2 5 8 12 15 2 5 9 10 13 2 5 9 10 14 2 5 9 10 15 2 5 9 11 13 2 5 9 11 14 2 5 9 11 15 2 5 9 12 13 2 5 9 12 14 2 5 9 12 15 2 6 7 10 13 2 6 7 10 14 2 6 7 10 15 2 6 7 11 13 2 6 7 11 14 2 6 7 11 15 2 6 7 12 13 2 6 7 12 14 2 6 7 12 15 2 6 8 10 13 2 6 8 10 14 2 6 8 10 15 2 6 8 11 13 2 6 8 11 14 2 6 8 11 15 2 6 8 12 13 2 6 8 12 14 2 6 8 12 15 2 6 9 10 13 2 6 9 10 14 2 6 9 10 15 2 6 9 11 13 2 6 9 11 14 2 6 9 11 15 2 6 9 12 13 2 6 9 12 14 2 6 9 12 15 3 4 7 10 13 3 4 7 10 14 3 4 7 10 15 3 4 7 11 13 3 4 7 11 14 3 4 7 11 15 3 4 7 12 13 3 4 7 12 14 3 4 7 12 15 3 4 8 10 13 3 4 8 10 14 3 4 8 10 15 3 4 8 11 13 3 4 8 11 14 3 4 8 11 15 3 4 8 12 13 3 4 8 12 14 3 4 8 12 15 3 4 9 10 13 3 4 9 10 14 3 4 9 10 15 3 4 9 11 13 3 4 9 11 14 3 4 9 11 15 3 4 9 12 13 3 4 9 12 14 3 4 9 12 15 3 5 7 10 13 3 5 7 10 14 3 5 7 10 15 3 5 7 11 13 3 5 7 11 14 3 5 7 11 15 3 5 7 12 13 3 5 7 12 14 3 5 7 12 15 3 5 8 10 13 3 5 8 10 14 3 5 8 10 15 3 5 8 11 13 3 5 8 11 14 3 5 8 11 15 3 5 8 12 13 3 5 8 12 14 3 5 8 12 15 3 5 9 10 13 3 5 9 10 14 3 5 9 10 15 3 5 9 11 13 3 5 9 11 14 3 5 9 11 15 3 5 9 12 13 3 5 9 12 14 3 5 9 12 15 3 6 7 10 13 3 6 7 10 14 3 6 7 10 15 3 6 7 11 13 3 6 7 11 14 3 6 7 11 15 3 6 7 12 13 3 6 7 12 14 3 6 7 12 15 3 6 8 10 13 3 6 8 10 14 3 6 8 10 15 3 6 8 11 13 3 6 8 11 14 3 6 8 11 15 3 6 8 12 13 3 6 8 12 14 3 6 8 12 15 3 6 9 10 13 3 6 9 10 14 3 6 9 10 15 3 6 9 11 13 3 6 9 11 14 3 6 9 11 15 3 6 9 12 13 3 6 9 12 14 3 6 9 12 15] assert(isequal(Ways(n,p),y_correct))

y_correct = 1 4 7 10 13 1 4 7 10 14 1 4 7 10 15 1 4 7 11 13 1 4 7 11 14 1 4 7 11 15 1 4 7 12 13 1 4 7 12 14 1 4 7 12 15 1 4 8 10 13 1 4 8 10 14 1 4 8 10 15 1 4 8 11 13 1 4 8 11 14 1 4 8 11 15 1 4 8 12 13 1 4 8 12 14 1 4 8 12 15 1 4 9 10 13 1 4 9 10 14 1 4 9 10 15 1 4 9 11 13 1 4 9 11 14 1 4 9 11 15 1 4 9 12 13 1 4 9 12 14 1 4 9 12 15 1 5 7 10 13 1 5 7 10 14 1 5 7 10 15 1 5 7 11 13 1 5 7 11 14 1 5 7 11 15 1 5 7 12 13 1 5 7 12 14 1 5 7 12 15 1 5 8 10 13 1 5 8 10 14 1 5 8 10 15 1 5 8 11 13 1 5 8 11 14 1 5 8 11 15 1 5 8 12 13 1 5 8 12 14 1 5 8 12 15 1 5 9 10 13 1 5 9 10 14 1 5 9 10 15 1 5 9 11 13 1 5 9 11 14 1 5 9 11 15 1 5 9 12 13 1 5 9 12 14 1 5 9 12 15 1 6 7 10 13 1 6 7 10 14 1 6 7 10 15 1 6 7 11 13 1 6 7 11 14 1 6 7 11 15 1 6 7 12 13 1 6 7 12 14 1 6 7 12 15 1 6 8 10 13 1 6 8 10 14 1 6 8 10 15 1 6 8 11 13 1 6 8 11 14 1 6 8 11 15 1 6 8 12 13 1 6 8 12 14 1 6 8 12 15 1 6 9 10 13 1 6 9 10 14 1 6 9 10 15 1 6 9 11 13 1 6 9 11 14 1 6 9 11 15 1 6 9 12 13 1 6 9 12 14 1 6 9 12 15 2 4 7 10 13 2 4 7 10 14 2 4 7 10 15 2 4 7 11 13 2 4 7 11 14 2 4 7 11 15 2 4 7 12 13 2 4 7 12 14 2 4 7 12 15 2 4 8 10 13 2 4 8 10 14 2 4 8 10 15 2 4 8 11 13 2 4 8 11 14 2 4 8 11 15 2 4 8 12 13 2 4 8 12 14 2 4 8 12 15 2 4 9 10 13 2 4 9 10 14 2 4 9 10 15 2 4 9 11 13 2 4 9 11 14 2 4 9 11 15 2 4 9 12 13 2 4 9 12 14 2 4 9 12 15 2 5 7 10 13 2 5 7 10 14 2 5 7 10 15 2 5 7 11 13 2 5 7 11 14 2 5 7 11 15 2 5 7 12 13 2 5 7 12 14 2 5 7 12 15 2 5 8 10 13 2 5 8 10 14 2 5 8 10 15 2 5 8 11 13 2 5 8 11 14 2 5 8 11 15 2 5 8 12 13 2 5 8 12 14 2 5 8 12 15 2 5 9 10 13 2 5 9 10 14 2 5 9 10 15 2 5 9 11 13 2 5 9 11 14 2 5 9 11 15 2 5 9 12 13 2 5 9 12 14 2 5 9 12 15 2 6 7 10 13 2 6 7 10 14 2 6 7 10 15 2 6 7 11 13 2 6 7 11 14 2 6 7 11 15 2 6 7 12 13 2 6 7 12 14 2 6 7 12 15 2 6 8 10 13 2 6 8 10 14 2 6 8 10 15 2 6 8 11 13 2 6 8 11 14 2 6 8 11 15 2 6 8 12 13 2 6 8 12 14 2 6 8 12 15 2 6 9 10 13 2 6 9 10 14 2 6 9 10 15 2 6 9 11 13 2 6 9 11 14 2 6 9 11 15 2 6 9 12 13 2 6 9 12 14 2 6 9 12 15 3 4 7 10 13 3 4 7 10 14 3 4 7 10 15 3 4 7 11 13 3 4 7 11 14 3 4 7 11 15 3 4 7 12 13 3 4 7 12 14 3 4 7 12 15 3 4 8 10 13 3 4 8 10 14 3 4 8 10 15 3 4 8 11 13 3 4 8 11 14 3 4 8 11 15 3 4 8 12 13 3 4 8 12 14 3 4 8 12 15 3 4 9 10 13 3 4 9 10 14 3 4 9 10 15 3 4 9 11 13 3 4 9 11 14 3 4 9 11 15 3 4 9 12 13 3 4 9 12 14 3 4 9 12 15 3 5 7 10 13 3 5 7 10 14 3 5 7 10 15 3 5 7 11 13 3 5 7 11 14 3 5 7 11 15 3 5 7 12 13 3 5 7 12 14 3 5 7 12 15 3 5 8 10 13 3 5 8 10 14 3 5 8 10 15 3 5 8 11 13 3 5 8 11 14 3 5 8 11 15 3 5 8 12 13 3 5 8 12 14 3 5 8 12 15 3 5 9 10 13 3 5 9 10 14 3 5 9 10 15 3 5 9 11 13 3 5 9 11 14 3 5 9 11 15 3 5 9 12 13 3 5 9 12 14 3 5 9 12 15 3 6 7 10 13 3 6 7 10 14 3 6 7 10 15 3 6 7 11 13 3 6 7 11 14 3 6 7 11 15 3 6 7 12 13 3 6 7 12 14 3 6 7 12 15 3 6 8 10 13 3 6 8 10 14 3 6 8 10 15 3 6 8 11 13 3 6 8 11 14 3 6 8 11 15 3 6 8 12 13 3 6 8 12 14 3 6 8 12 15 3 6 9 10 13 3 6 9 10 14 3 6 9 10 15 3 6 9 11 13 3 6 9 11 14 3 6 9 11 15 3 6 9 12 13 3 6 9 12 14 3 6 9 12 15

Output argument "y" (and maybe others) not assigned during call to "Ways". Error in Test2 (line 248) assert(isequal(Ways(n,p),y_correct))

3   Fail
n=3; p=3; y_correct =[1 4 7 1 4 8 1 4 9 1 5 7 1 5 8 1 5 9 1 6 7 1 6 8 1 6 9 2 4 7 2 4 8 2 4 9 2 5 7 2 5 8 2 5 9 2 6 7 2 6 8 2 6 9 3 4 7 3 4 8 3 4 9 3 5 7 3 5 8 3 5 9 3 6 7 3 6 8 3 6 9] assert(isequal(Ways(n,p),y_correct))

y_correct = 1 4 7 1 4 8 1 4 9 1 5 7 1 5 8 1 5 9 1 6 7 1 6 8 1 6 9 2 4 7 2 4 8 2 4 9 2 5 7 2 5 8 2 5 9 2 6 7 2 6 8 2 6 9 3 4 7 3 4 8 3 4 9 3 5 7 3 5 8 3 5 9 3 6 7 3 6 8 3 6 9

Output argument "y" (and maybe others) not assigned during call to "Ways". Error in Test3 (line 30) assert(isequal(Ways(n,p),y_correct))

4   Fail
p=1; n=2; G=[1;2] assert(isequal(Ways(n,p),G))

G = 1 2

Output argument "y" (and maybe others) not assigned during call to "Ways". Error in Test4 (line 4) assert(isequal(Ways(n,p),G))

5   Fail
p=4 n=2 G=[1 3 5 7 1 3 5 8 1 3 6 7 1 3 6 8 1 4 5 7 1 4 5 8 1 4 6 7 1 4 6 8 2 3 5 7 2 3 5 8 2 3 6 7 2 3 6 8 2 4 5 7 2 4 5 8 2 4 6 7 2 4 6 8] assert(isequal(Ways(n,p),G))

p = 4 n = 2 G = 1 3 5 7 1 3 5 8 1 3 6 7 1 3 6 8 1 4 5 7 1 4 5 8 1 4 6 7 1 4 6 8 2 3 5 7 2 3 5 8 2 3 6 7 2 3 6 8 2 4 5 7 2 4 5 8 2 4 6 7 2 4 6 8

Output argument "y" (and maybe others) not assigned during call to "Ways". Error in Test5 (line 19) assert(isequal(Ways(n,p),G))

### Community Treasure Hunt

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

Start Hunting!