comefrom: <doocs>1230.Toss Strange Coins_1.py
code: def probabilityOfHeads( prob: List[float], target: int) -> float:
      dp = [0] * (target + 1)
      dp[0] = 1
      for v in prob:
          for j in range(target, -1, -1):
              dp[j] *= 1 - v
              if j >= 1:
                  dp[j] += dp[j - 1] * v
      return dp[-1]
masked: def sample_funcname ( var_0 : List [ float ] , var_3 : int ) -> float :
      var_7 = [ 0 ] * ( var_3 + 1 )
      var_7 [ 0 ] = 1
      for var_8 in var_0 :
          for var_10 in range ( var_3 , - 1 , - 1 ) :
              var_7 [ var_10 ] *= 1 - var_8
              if var_10 >= 1 :
                  var_7 [ var_10 ] += var_7 [ var_10 - 1 ] * var_8
      return var_7 [ - 1 ]
  