Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lis = [float(x) for x in input().split()]
- target = float(input())
- def binary(lis,target):
- lo = 0;
- hi = 100
- m = ( lo + hi ) /2.0
- while hi-lo>0.000001:
- m = (lo+hi)/2.0
- total = calculate(lis+[m])
- if total <= target+0.00001:
- lo = m
- else:
- hi = m
- return m
- def calculate(lis):
- #print(lis)
- return sum(sorted(lis)[1:4])/3.0
- result = binary(lis,target)
- if result <= 0.9:
- print("impossible")
- elif result >= 30:
- print("infinite")
- else:
- print("%.2f" % result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement