Богданов Евгений 524 ArbitPrec 6037
Пятаков Никита, 125 группа ArbitPrec 6097
t1from decimal import *t1from decimal import *
2inp = input()2inp = input()
3accuracy = int(input())3accuracy = int(input())
4getcontext().prec = accuracy + 24getcontext().prec = accuracy + 2
5(left, right) = (Decimal(-1.5), Decimal(1.5))5(left, right) = (Decimal(-1.5), Decimal(1.5))
6x = Decimal((Decimal(right) + Decimal(left)) / 2)6x = Decimal((Decimal(right) + Decimal(left)) / 2)
7res = eval(inp)7res = eval(inp)
8while res != Decimal(0) and x != left and (x != right):8while res != Decimal(0) and x != left and (x != right):
9    if res > Decimal(0):9    if res > Decimal(0):
10        right = Decimal(x)10        right = Decimal(x)
11    else:11    else:
12        left = Decimal(x)12        left = Decimal(x)
13    x = Decimal((Decimal(right) + Decimal(left)) / 2)13    x = Decimal((Decimal(right) + Decimal(left)) / 2)
14    res = eval(inp)14    res = eval(inp)
15format_out = '{:.' + f'{accuracy}f' + '}'15format_out = '{:.' + f'{accuracy}f' + '}'
16print(format_out.format(x))16print(format_out.format(x))
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op