Editorial for Bedao Regular Contest 16 - Đá thủ
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Ta có ~2~ khả năng xảy ra:
- Nếu ~n~ lẻ, Lihwy có thể bốc ~n - 2~ viên đá (vì ~\gcd(n, n - 2) = 1~) và ép FireGhost phải thua.
- Ngược lại, nếu ~n~ chẵn, Lihwy chỉ có thể bốc ra một số lượng lẻ viên đá. Vì số lượng viên đá còn lại là lẻ, FireGhost có thể sử dụng chiến thuật như trên để ép Lihwy phải thua.
Code mẫu
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (n & 1) { cout << "Lihwy\n"; } else { cout << "FireGhost\n"; } } }
Comments