Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python
- import time
- t1 = time.clock()
- f = open("testing/test_cases.txt","r")
- o = open("testing/Pyoutput.txt","w")
- cases = int(f.readline())
- while cases > 0:
- cases -= 1
- gain = 0.0
- p = float(f.readline())
- if p >= .5:
- gain = 10000 * (1-p) * (2*p-1)
- else:
- gain = p * 10000 * (1-2*p)
- o.write(str(gain+10000)+"\n")
- f.close()
- o.close()
- t2 = time.clock()
- print "Took ",t2-t1," seconds"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement