#最大公约数#CF346A Alice and Bob

题目传送门
CF346A


分析

可以发现其所能表示的数就是能被最大公约数整除的数,且这些数不能超过最大值,
于是判断一下取数的奇偶性即可


代码

#include <cstdio>
#include <cctype>
#define rr register
using namespace std;
int n,mx,Gcd;
inline signed iut(){
	rr int ans=0; rr char c=getchar();
	while (!isdigit(c)) c=getchar();
	while (isdigit(c)) ans=(ans<<3)+(ans<<1)+(c^48),c=getchar();
	return ans;
}
inline signed gcd(int x,int y){return y?gcd(y,x%y):x;}
signed main(){
	n=iut();
	for (rr int i=1;i<=n;++i){
		rr int x=iut();
		mx=mx>x?mx:x,Gcd=gcd(Gcd,x);
	}
	puts(((mx/Gcd-n)&1)?"Alice":"Bob");
	return 0;
}
原文地址:https://www.cnblogs.com/Spare-No-Effort/p/15423454.html