I am not able to understand the editorial of the same. Please Help!! Link to the problem : http://codeforces.net/problemset/problem/343/A
# | 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 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
I am not able to understand the editorial of the same. Please Help!! Link to the problem : http://codeforces.net/problemset/problem/343/A
Name |
---|
When a > b, you can use floor(a / b) resistors consecutively connected, and now, you still need to obtain the fraction (a mod b) / b because:
floor(a / b) + (a mod b) / b = a / b
For example, 8 / 3 = 2 + 2 / 3.
So, the problem become to obtain the ratio 2 / 3. Now we have to obtain this ratio from the parallel property, because no consecutive resistors can make it. And as we can see from the statement, parallel connected resistors R1, R2, ... obtain one resistor with resistance with value equals to 1 / (1 / R1 + 1 / R2 + ...), and as this fraction shows, the denominator can be represented as several resistors consecutively connected to each other. So, the task return to be obtaining this sum 1 / R1 + 1 / R2 + ....
For that, we can rewrite the fraction 2 / 3 as 1 / (3 / 2), and then try to obtain 3 / 2 from consecutively connected resistors with the same way we used in the case of a > b above, and the solution goes recursively like that until the remaining fraction become 0.
This is my submission for this problem
Thank you so much!! :)
Don't know it'll be helpful or not but I found this link somewhat related to this problem.
https://math.stackexchange.com/questions/2160766/how-many-resistors-are-needed
Thanks, your assistance is appreciated!! :)