P11899
Solution
考虑真正的
问题转化为:
除以质因子变成了减
如果所有数都是
首先肯定尽可能选质数,因为只要操作质数就能得一分,所以刚开始两人都会先选质数。设选完后两人的分为
如果当前轮到后手,
如果轮到前者且
如果轮到前者且
随便打个
code
int a[2000007], num[10000007], minn[10000007];
inline void work(int v) {
for (int i = 2; i <= v; ++i) {
if (minn[i] == 0) {
minn[i] = i;
for (int j = 2 * i; j <= v; j += i) {
if (minn[j] == 0) {
minn[j] = i;
}
}
}
}
num[1] = 0;
for (int i = 2; i <= v; ++i) {
if (minn[i] == i) {
num[i] = 1;
} else {
num[i] = 1 + num[i / minn[i]];
}
}
}
int c, s;
inline void solve() {
work(10000000);
c = s = 0;
Fastio::cin >> n;
for(int i = 1; i <= n; i++){
Fastio::cin >> a[i];
a[i] = num[a[i]];
if(a[i] == 1) c = c + 1;
else s = s + a[i] - 2;
}
int ansa = (c + 1) / 2;
int ansb = c / 2;
s = s & 1;
s ^= c & 1;
if(s){
puts("Lucky_Holmes");
return;
}
else if(ansa == ansb){
ansb = ansb + n - c;
}
else{
puts("Lucky_Holmes");
return;
}
if(ansa == ansb){
puts("Draw");
return;
}
puts("Angry_Waston");
}
计算操作到只剩
先操作进行 (s+c)&1,等于 (s&1)^(c&1)。