Need help with a game problem

Revision en3, by Kane, 2017-04-05 15:52:04

I'm trying to solve problem Game of Cards from SWERC-2015.

I guess, that this game is equivalent to Nim game. I calculated the Sprague-Grandy value from every pile of cards and counted xor of them.

Unfortunately, my solution gets WA on 7 test.

Please, help me with this problem.

Code

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Kane 2017-04-05 15:52:04 1 Tiny change: 'value frome every pil' -> 'value from every pil'
en2 English Kane 2017-04-05 14:26:36 15
en1 English Kane 2017-04-05 14:26:12 379 Initial revision for English translation
ru1 Russian Kane 2017-04-05 14:14:09 382 Первая редакция (опубликовано)