Problem 43575. Probabilities - More brains than luck

Solution 2112674

Submitted on 31 Jan 2020 by Wayne
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
C=1; N=6; K=2; [P,XK,M] = test_suite_prob(N,C,K); Pc=0.166666; XKc=0.138888; Mc=6; tol=1e-6; assert( (abs(P-Pc)<tol)&(abs(XK-XKc)<tol)&(abs(M-Mc)<tol) );

2   Pass
C=3; N=6; K=2; [P,XK,M] = test_suite_prob(N,C,K); Pc=0.004629; XKc=0.004608; Mc=216; tol=1e-6; assert( (abs(P-Pc)<tol)&(abs(XK-XKc)<tol)&(abs(M-Mc)<tol) );

3   Pass
C=2; N=6; K=6; [P,XK,M] = test_suite_prob(N,C,K); Pc=0.027777; XKc=0.024128; Mc=36; tol=1e-6; assert( (abs(P-Pc)<tol)&(abs(XK-XKc)<tol)&(abs(M-Mc)<tol) );

4   Pass
C=8; N=2; K=20; [P,XK,M] = test_suite_prob(N,C,K); Pc=0.003906; XKc=0.003626; Mc=256; tol=1e-6; assert( (abs(P-Pc)<tol)&(abs(XK-XKc)<tol)&(abs(M-Mc)<tol) );

5   Pass
C=4; N=5; K=7; [P,XK,M] = test_suite_prob(N,C,K); Pc=0.001600; XKc=0.001584; Mc=625; tol=1e-6; assert( (abs(P-Pc)<tol)&(abs(XK-XKc)<tol)&(abs(M-Mc)<tol) );

6   Pass
C=5; N=1; K=2; [P,XK,M] = test_suite_prob(N,C,K); Pc=1; XKc=0; Mc=1; tol=1e-6; assert( (abs(P-Pc)<tol)&(abs(XK-XKc)<tol)&(abs(M-Mc)<tol) );

Suggested Problems

More from this Author14

Community Treasure Hunt

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

Start Hunting!