fork download
  1. def parse(inFile):
  2. [A, B] = inFile.getInts()
  3. return (A, B, inFile.getFloats())
  4.  
  5. def solve((A, B, probs)):
  6. rec = 2 + B
  7. prob = 1.0
  8. for i in xrange(A + 1):
  9. if (i > 0):
  10. prob = prob * probs[i-1]
  11. score = (A + B + 1 - (2 * i)) + (1 - prob) * (B + 1)
  12. if (score < rec):
  13. rec = score
  14. return "%.7f" % rec
  15.  
  16. if __name__ == "__main__":
  17. from GCJ import GCJ
  18. GCJ(parse, solve, "/Users/lpebody/gcj/2012_1a/", "a").run()
  19.  
  20.  
  21.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty