Would someone help me out? example3 case failed.
My intuitive idea is that \nstep1, get the total number ways (TOTAL) to get score>=K;\nstep2, and get the total number ways  (COUNT)to get score <=N\nand result
My intuitive idea is that \nstep1, get the total number ways (TOTAL) to get score>=K;\nstep2, and get the total number ways  (COUNT)to get score <=N\nand resulting probability is(TOTAL / COUNT).\nHere is my brute-force code(I think memorization could be applied...let us just ignore it. Just focus on the correctness of my intutive idea)\n\t\t\n\tint count = 0;\n\tpublic double new21Game(int N, int K, int W) {\n\t\tif (N == 0) {\n\t\t\treturn 0.0;\n\t\t}\n\t\tint total = dfs(0, K, W, N, );\n\t\treturn count * 1.0 / total;\n\t}\n\t\t//Definition: what is the total ways of ending the game when the current sum is "total" and     //the numberwe could draw is [1, W].\n\tprivate int dfs(int curSum, int K, int W, int N) {\n\t\t\t//Base case.\n\t\t\tif (curSum >= K) {\n\t\t\t\tif (curSum <= N) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\t//Recursive case.\n\t\t\tint count = 0;\n\t\t\tfor (int i = 1; i <= W; i++) {\n\t\t\t\tcount += dfs(curSum + i, K, W, N);\n\t\t\t}\n\t\t\treturn count;\n\t}\n\t\t\n\t\t\nthe result for ex. 3 is:\nInput:\n21\n17\n10\nOutput:\n0.55218\nExpected:\n0.73278\n\t\t
[]