I am not able to understand the editorial of the same. Please Help!! Link to the problem : http://mirror.codeforces.com/problemset/problem/343/A
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I am not able to understand the editorial of the same. Please Help!! Link to the problem : http://mirror.codeforces.com/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!! :)