300620: CF119A. Epic Game
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Epic Game
题意翻译
# 题目描述 Simon和Antisimon在玩石子游戏。 共有n颗石子,Simon先拿。 Simon能拿当前n和a的最大公约数,Antisimon能拿当前n和b的最大公约数。 当有一个人不能拿时(n=0)那个人就输了。 求谁赢了。 # 输入输出格式 **输入格式** 一行,a,b,n(1<=a,b,n<=100) **输出格式** 一行,如果Simon赢了,输出0;Antisimon赢了,输出1. # 说明 gcd(0,x)=gcd(x,0)=x; 对于样例1: Simon拿gcd(3,9)=3颗 Antisimon拿gcd(5,6)=1颗 Simon拿gcd(3,5)=1颗 Antisimon拿gcd(5,4)=1颗 Simon拿gcd(3,3)=3颗 Antisimon输了 感谢@引领天下 提供的翻译题目描述
Simon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't change throughout the game. Simon receives number $ a $ and Antisimon receives number $ b $ . They also have a heap of $ n $ stones. 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 has strictly less stones left than one needs to take). Your task is to determine by the given $ a $ , $ b $ and $ n $ who wins the game.输入输出格式
输入格式
The only string contains space-separated integers $ a $ , $ b $ and $ n $ ( $ 1<=a,b,n<=100 $ ) — the fixed numbers Simon and Antisimon have received correspondingly and the initial number of stones in the pile.
输出格式
If Simon wins, print "0" (without the quotes), otherwise print "1" (without the quotes).
输入输出样例
输入样例 #1
3 5 9
输出样例 #1
0
输入样例 #2
1 1 100
输出样例 #2
1