how are we supposed to solve this problem?
# | User | Rating |
---|---|---|
No items |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 164 |
3 | adamant | 163 |
4 | TheScrasse | 159 |
5 | nor | 158 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 151 |
8 | SecondThread | 147 |
9 | orz | 146 |
10 | pajenegod | 145 |
how are we supposed to solve this problem?
Name |
---|
Each balanced parenthesis sequence can be reduced to an equivalent nim piles using the following rules. Let *A denote the nim value of balanced sequence A. *() = 1 *(A) = *A + 1 *AB = *A ^ *B So just find the nim value of the given sequence. If it is 0, then it is a losing position for the first player, else winning. :)