Cody

# Problem 1855. Usage of java.math : N Choose K with unlimited precision

Solution 1326470

Submitted on 3 Nov 2017
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
tic N=5;K=2; NK=nchoosekJava(N,K); toc assert(strcmp(NK,num2str(nchoosek(N,K))))

numerator = 5

Undefined function or variable 'k'. Error in nchoosekJava (line 3) for i = N-k+1 : N-1, Error in Test1 (line 3) NK=nchoosekJava(N,K);

2   Fail
tic N=randi(10); K=randi(N); NK=nchoosekJava(N,K); toc assert(strcmp(NK,num2str(nchoosek(N,K))))

numerator = 5

Undefined function or variable 'k'. Error in nchoosekJava (line 3) for i = N-k+1 : N-1, Error in Test2 (line 4) NK=nchoosekJava(N,K);

3   Fail
tic N=100; K=50; NK=nchoosekJava(N,K); toc assert(strcmp(NK,'100891344545564193334812497256'))

numerator = 100

Undefined function or variable 'k'. Error in nchoosekJava (line 3) for i = N-k+1 : N-1, Error in Test3 (line 4) NK=nchoosekJava(N,K);

4   Fail
tic N=200; K=75; NK=nchoosekJava(N,K); toc assert(strcmp(NK,'168849997346404286704489530268603459022868706883102845056'))

numerator = 200

Undefined function or variable 'k'. Error in nchoosekJava (line 3) for i = N-k+1 : N-1, Error in Test4 (line 4) NK=nchoosekJava(N,K);