fork(4) download
  1. from decimal import Decimal
  2. def solve(n):
  3. if n <= 9:
  4. return 0.0
  5. dp = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
  6. #dp = [1, 2, 4, 8, 16, 32, 64]
  7. cnt = 10
  8. while cnt <= n:
  9. next = sum(dp)
  10. #print next
  11. dp[cnt%10] = next
  12. cnt += 1
  13. #print next, 2**n
  14. return 1 - Decimal(next)/Decimal(2**n)
Success #stdin #stdout 0.02s 8520KB
stdin
Standard input is empty
stdout
Standard output is empty