当时复习一下吧= =。很久没看真的不记得了
#include <iostream>
using namespace std;
int gcd(int a, int b)
{
if (b==0)
{
return a;
}
else
{
int t;
t = a;
while (a%b != 0)
{
a = b;
b = t % b;
t = a;
}
return b;
}
}
int main()
{
int a, b, n, t = 0; int flag;
cin >> a >> b >> n;
while (1)
{
t = gcd(a, n);
if (t > n)
{
flag = 1;
cout << flag << endl; break;
}
n = n - t;
t = gcd(b, n);
if (t>n)
{
flag = 0;
cout << flag << endl; break;
}
n = n - t;
}
}