POJ 2975 Nim problem solution "Challenge Programming Contest"

POJ 2975 Nim problem solution "Challenge Programming Contest"
POJ 2975 Nim Nim tricks: In classical Nim game, win the upper hand how many methods? 4.2 to find a winning strategy game of Nim and Grundy number of classical algorithms, XOR = k0 ^ k1 ^ ... ^ kn-1, if it is 0, then losing the upper hand, or else win. When win state, the upper hand to do is take a stack of m stones, such XOR becomes 0, the losing state flip passed, the subject is asked to make several XOR method becomes 0 . M blocks away assuming one of these methods is the i-th stack from stones, there are (ki-m) ^ (XOR ^ ki) = 0. Here (ki-m) represents the i stack stone away the remaining part to m, (XOR ^ ki) from the representative ...

Continue reading : yard farm >> POJ 2975 Nim problem solution "Challenge Programming Contest"

Original link : http://www.hankcs.com/program/algorithm/poj-2975-nim.html

Reproduced in: https: //my.oschina.net/hankcs/blog/680290

Guess you like

Origin blog.csdn.net/weixin_33713350/article/details/91780240