1. 程式人生 > >codeforces Epic Game 題解

codeforces Epic Game 題解

Simon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't change throughout the game. Simon receives numberaand Antisimon receives numberb. They also have a heap ofnstones. The players take turns to make a move and Simon starts. During a move a player should take from the heap the number of stones equal to the greatest common divisor of the fixed number he has received and the number of stones left in the heap. A player loses when he cannot take the required number of stones (i. e. the heap hasstrictly

less stones left than one needs to take).

Your task is to determine by the givena,bandnwho wins the game.