- C20250080's blog
6
- 2024-5-17 9:29:42 @
from math import *
x = eval(input())
def s(x):
return f(x)#f(x)是一个多项式方程
while True:
if s(x) < 0 and s(x+0.05) > 0:
a,b = x,x+0.05
while abs(s((a+b)/2)) > 0.0000000000001:
if s((a+b)/2) < 0:
a = (a+b)/2
else:
b = (a+b)/2
print((a+b)/2)
break
elif s(x) > 0 and s(x+0.05) < 0:
b,a = x,x+0.05
while abs(s((a+b)/2)) > 0.0000000000001:
if s((a+b)/2) < 0:
a = (a+b)/2
else:
b = (a+b)/2
print((a+b)/2)
break
x += 0.05