Python3 Solution
\n\nclass Solution:\n    def new21Game(self, n: int, k: int, maxPts: int) -> float:\n        if k==0 or n>=k+maxPts:\n            return 1\n\n        dp=[1.0]+[
\n```\nclass Solution:\n    def new21Game(self, n: int, k: int, maxPts: int) -> float:\n        if k==0 or n>=k+maxPts:\n            return 1\n\n        dp=[1.0]+[0.0]*n\n        maxPts_sum=1.0\n        for i in range(1,n+1):\n            dp[i]=maxPts_sum/maxPts\n            if i<k:\n                maxPts_sum+=dp[i]\n\n            if i-maxPts>=0:\n                maxPts_sum-=dp[i-maxPts]\n\n\n        return sum(dp[k:])                \n```
['Python', 'Python3']