Cody

Solution 1355124

Submitted on 23 Nov 2017 by David Verrelli
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(.5, round(1e6*coin_head_match(1))/1e6))

vec = 1 1 P = 0.5000 P = 0.5000

2   Pass
assert(isequal(.375, round(1e6*coin_head_match(2))/1e6))

vec = 1 2 1 P = 0.3750 P = 0.3750

3   Pass
assert(isequal(.3125, round(1e6*coin_head_match(3))/1e6))

vec = 1 3 3 1 P = 0.3125 P = 0.3125

4   Pass
assert(isequal(.273438, round(1e6*coin_head_match(4))/1e6))

vec = 1 4 6 4 1 P = 0.2734 P = 0.2734

5   Pass
assert(isequal(.246094, round(1e6*coin_head_match(5))/1e6))

vec = 1 5 10 10 5 1 P = 0.2461 P = 0.2461

6   Pass
assert(isequal(.225586, round(1e6*coin_head_match(6))/1e6))

vec = 1 6 15 20 15 6 1 P = 0.2256 P = 0.2256

7   Pass
assert(isequal(.139950, round(1e6*coin_head_match(16))/1e6))

vec = Columns 1 through 14 1 16 120 560 1820 4368 8008 11440 12870 11440 8008 4368 1820 560 Columns 15 through 17 120 16 1 P = 0.1399 P = 0.1399

8   Pass
assert(isequal(.125371, round(1e6*coin_head_match(20))/1e6))

vec = Columns 1 through 14 1 20 190 1140 4845 15504 38760 77520 125970 167960 184756 167960 125970 77520 Columns 15 through 21 38760 15504 4845 1140 190 20 1 P = 0.1254 P = 0.1254

9   Pass
assert(isequal(.114567, round(1e6*coin_head_match(24))/1e6))

vec = 1.0e+06 * Columns 1 through 17 0.0000 0.0000 0.0003 0.0020 0.0106 0.0425 0.1346 0.3461 0.7355 1.3075 1.9613 2.4961 2.7042 2.4961 1.9613 1.3075 0.7355 Columns 18 through 25 0.3461 0.1346 0.0425 0.0106 0.0020 0.0003 0.0000 0.0000 P = 0.1146 P = 0.1146

10   Pass
assert(~isequal(1,2))

11   Pass
assert(isequal(.099347, round(1e6*coin_head_match(32))/1e6))

vec = 1.0e+08 * Columns 1 through 17 0.0000 0.0000 0.0000 0.0000 0.0004 0.0020 0.0091 0.0337 0.1052 0.2805 0.6451 1.2902 2.2579 3.4737 4.7144 5.6572 6.0108 Columns 18 through 33 5.6572 4.7144 3.4737 2.2579 1.2902 0.6451 0.2805 0.1052 0.0337 0.0091 0.0020 0.0004 0.0000 0.0000 0.0000 0.0000 P = 0.0993 P = 0.0993

12   Pass
assert(isequal(.070386, round(1e6*coin_head_match(64))/1e6))

vec = 1.0e+18 * Columns 1 through 17 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0002 0.0005 Columns 18 through 34 0.0014 0.0036 0.0087 0.0196 0.0411 0.0803 0.1467 0.2506 0.4010 0.6016 0.8466 1.1188 1.3888 1.6203 1.7771 1.8326 1.7771 Columns 35 through 51 1.6203 1.3888 1.1188 0.8466 0.6016 0.4010 0.2506 0.1467 0.0803 0.0411 0.0196 0.0087 0.0036 0.0014 0.0005 0.0002 0.0000 Columns 52 through 65 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 P = 0.0704 P = 0.0704