In this problem many did binary search and calculated the value of the function and stored the values in doubles and compared the results.
Shouldn't there be precision errors? As you are multiplying something with like (1.99999)^100?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
8 | awoo | 154 |
10 | luogu_official | 150 |
In this problem many did binary search and calculated the value of the function and stored the values in doubles and compared the results.
Shouldn't there be precision errors? As you are multiplying something with like (1.99999)^100?
Name |
---|
Also why is the polynomial an increasing function? Because xy is greater than xy + 1 for x < 1.
At r=-1, the value of the polynomial is clearly positive, because cm is positive. And since there is only one root in the range -1<r<1, thus the polynomial has one root dividing the function into two parts. That is why you can do binary search.
what if the function has a double root
it's specified in the question that there is only one root in the range (-1,1)
But how can you guarantee the function is decreasing
If you directly try to find the value of (1.99999)^100 then it is not possible. So, what we can do is divide the whole equation by the highest power of (1+r) so that (1+r)^x for all x is in the denominator. Now we can define a variable denom = 1/(1+r) and if we do denom/=(1+r) for x times then it is equivalent to 1/((1+r)^x). We can use this value with the corresponding cost values.
okay, If u divide it with the highest power of (1+r) then the one which originally had power 0, now has power (1+r) ^ (-highest_power) . Now this value is very small! and again, shouldn't it cause precision errors?