A.Haitang and Game
思路:直接暴力的枚举 g c d gcd gcd,判断在给出的数里面能否有两个数的 g c d gcd gcd为它,j奇数是 d X q w q dXqwq dXqwq赢,偶数是 H a i t a n g Haitang Haitang赢,可以发现这个题的总操作次数是不变的,不会因为策略的改变而改变
void solve() {
int n; cin >> n;
vector<int> vis(N);
int mx = 0;
for (int i = 1, x; i <= n; i ++) {
cin >> x;
vis[x] = 1;
}
int cnt = 0;
for (int i = 1; i <= 1e5; i ++) {
int gc = 0;
if (vis[i]) continue;
for (int j = i + i; j <= 1e5; j += i) {
if (vis[j]) gc = __gcd(j, gc);
}
if (gc == i) cnt ++;
}
if (cnt & 1) cout << "dXqwq\n";
else cout << "Haitang\n";
}
E.Haitang and Math
思路:待补
J.Haitang and Triangle
思路:待补
K.Haitang and Ava
思路:从前往后,能消除 a v a v a avava avava优先消除,然后再看消除 a v a ava ava,否则就不行
void solve() {
string s; cin >> s;
for (int i = 0; i < s.size(); i ++) {
if (s.substr(i, 5) == "avava") i += 4;
else if (s.substr(i, 3) == "ava") i += 2;
else {
cout << "No\n";
return ;
}
}
cout << "Yes\n";
}