| UT 104c Final Exam |
|---|
| Закончено |
On a whim, you "invested" $200 in cryptocurrency. After monitoring the markets for a few days, you notice that the (fiat) value of your portfolio seems to be changing according to the formula
$$$$$$v(t) = 100e^{-A t} + 100 e^{-B t}$$$$$$ where $$$t$$$ is the time in days since you bought the cryptocurrency and $$$A$$$ and $$$B$$$ are positive constants. From your calculus classes, you know that $$$v(t)$$$ is a strictly decreasing function.
You don't want to lose all of your money, so you've decided to sell when the value of your portfolio becomes half of its starting value: in other words, when $$$v(t) = 100.$$$
Assuming that the value of your portfolio continues to follow the formula above, at what time (value of $$$t$$$) should you sell the cryptocurrency?
The only line of input consists of two space-separated real numbers $$$A$$$ and $$$B$$$. These constants satisfy $$$0.5 \leq A, B \leq 50$$$.
Print the value of $$$t$$$ for which $$$v(t) = 100$$$. Your answer will be judged correct if it matches the judge solution with absolute or relative error $$$10^{-4}$$$.
Hint: this means you need to print your answer with many digits of precision.
0.67 42.0
0.0725691653788089752197265625
3.14159265 2.71828
0.2370033897459506988525390625
All popular languages have built-in support for calculating $$$e^x$$$.
Java:
double result = Math.exp(x);
Python:
import math
result = math.exp(x)
C++:
#include <cmath>
double result = std::exp(x);
| Название |
|---|


