【題解】Codeforces 1363C. Game On Leaves

【題目敘述】http://codeforces.com/contest/1363/problem/C

#include <iostream>
using namespace std;
 
int t, n, x, a, b, cnt;
 
int main() {
    cin >> t;
    while (t--){
        cin >> n >> x;
        cnt = 0;
        for (int i = 1; i < n; i++){
            cin >> a >> b;
            if (a == x || b == x) cnt++;
        }
        if (cnt <= 1 || n % 2 == 0) cout << "Ayush\n";
        else cout << "Ashish\n";
    }
}
分享本文 Share with friends