Java - DP - 3 ms, faster than 98.51% - 35.5 MB, less than 24.32%
\nclass Solution {\n    public double new21Game(int N, int K, int W) {\n        if (K == 0 || K + W <= N) {\n            return 1;\n        }\n        if (N < K
```\nclass Solution {\n    public double new21Game(int N, int K, int W) {\n        if (K == 0 || K + W <= N) {\n            return 1;\n        }\n        if (N < K) {\n            return 0;\n        }\n        double base = 1.0 / W;\n        double[] dp = new double[N + 1];\n        double sum = 0;\n        double res = 0;\n        for (int i = 1; i <= N; ++i) {\n            dp[i] = sum * base + (i <= W ? base : 0);\n            if (i < K) {\n                sum += dp[i];\n            }\n            if (i > W) {\n                sum -= dp[i - W];\n            }\n            if (i >= K) {\n                res += dp[i];\n            }\n        }\n        return res;\n    }\n}\n```
[]