Cody

Problem 1159. Coin Tossing: Probability of Same Heads for N tosses

Solution 184268

Submitted on 2 Jan 2013 by Khaled Hamed
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
``` ```
2   Pass
``` ```
3   Pass
``` ```
4   Pass
``` ```
5   Pass
``` ```
6   Pass
``` ```
7   Pass
``` ```
8   Pass
``` ```
``` ```
``` ```
``` ```
```[Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] [Warning: Result may not be exact. Coefficient is greater than 1.000000e+15 and is only accurate to 15 digits] [> In nchoosek at 64 In coin_head_match>@(x)(nchoosek(n,x)*.5^n).^2 at 2 In coin_head_match at 2 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] ```