Does anyone have a simpler approach of solving this problem? Please share with me.
# | 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 |
Does anyone have a simpler approach of solving this problem? Please share with me.
Name |
---|
if u can understand python the refer to my solution https://codeforces.me/contest/1152/submission/53235674 starting from MSB following a greedy type appraoch
Can you explain your logic I have difficulty in reading python. Thanks!
first of all i converted the number into its binary and then checked if all bits are set if not then i start traversing from the most significant bit if a bit is set then continue else i calculated the length of all the bits starting from that '0' bit and then xored it with the number(all bits set with the lenght i calculated) AND then checked if the number becomes 2^n-1 (break if yes) else continue till the number becomes 2^n-1 (till we reach the last bit). take an example and u will understand refering to my code
Thanks! Understood
sorry for the down vote by mistake:)
No problem. I don't care about those a question is a question l.
I finally solved it using almost the same idea of yours. AC in 7 goes. my solution Thanks!.