f | from decimal import * | f | from decimal import * |
| | | |
n | def pi(): | n | def pi_prec(): |
| getcontext().prec += 2 | | getcontext().prec += 2 |
| three = Decimal(3) | | three = Decimal(3) |
| (lasts, t, s, n, na, d, da) = (0, three, 3, 1, 0, 0, 24) | | (lasts, t, s, n, na, d, da) = (0, three, 3, 1, 0, 0, 24) |
| while s != lasts: | | while s != lasts: |
| lasts = s | | lasts = s |
| (n, na) = (n + na, na + 8) | | (n, na) = (n + na, na + 8) |
| (d, da) = (d + da, da + 32) | | (d, da) = (d + da, da + 32) |
| t = t * n / d | | t = t * n / d |
| s += t | | s += t |
| getcontext().prec -= 2 | | getcontext().prec -= 2 |
| return +s | | return +s |
| | | |
n | def mycos(x): | n | def cos(x): |
| getcontext().prec += 2 | | getcontext().prec += 2 |
| (i, lasts, s, fact, num, sign) = (0, 0, 1, 1, 1, 1) | | (i, lasts, s, fact, num, sign) = (0, 0, 1, 1, 1, 1) |
| while s != lasts: | | while s != lasts: |
| lasts = s | | lasts = s |
| i += 2 | | i += 2 |
| fact *= i * (i - 1) | | fact *= i * (i - 1) |
| num *= x * x | | num *= x * x |
| sign *= -1 | | sign *= -1 |
| s += num / fact * sign | | s += num / fact * sign |
| getcontext().prec -= 2 | | getcontext().prec -= 2 |
| return +s | | return +s |
| | | |
n | def mysin(x): | n | def sin(x): |
| getcontext().prec += 2 | | getcontext().prec += 2 |
| (i, lasts, s, fact, num, sign) = (1, 0, x, 1, x, 1) | | (i, lasts, s, fact, num, sign) = (1, 0, x, 1, x, 1) |
| while s != lasts: | | while s != lasts: |
| lasts = s | | lasts = s |
| i += 2 | | i += 2 |
| fact *= i * (i - 1) | | fact *= i * (i - 1) |
| num *= x * x | | num *= x * x |
| sign *= -1 | | sign *= -1 |
| s += num / fact * sign | | s += num / fact * sign |
| getcontext().prec -= 2 | | getcontext().prec -= 2 |
| return +s | | return +s |
t | A = input() | t | a = input() |
| E = input() | | e = input() |
| getcontext().prec = int(E) + 3 | | getcontext().prec = int(e) + 3 |
| corner = Decimal(A) * Decimal('0.9') * pi() / Decimal('180') | | rd = Decimal(a) * Decimal('0.9') * pi_prec() / Decimal('180') |
| mytan = mysin(corner) / mycos(corner) | | tan = sin(rd) / cos(rd) |
| getcontext().prec = int(E) | | getcontext().prec = int(e) |
| print(str(+mytan)) | | print(str(+tan)) |