台阶-Nim游戏

AcWing-892-台阶-Nim游戏open in new window

实现

#include <iostream>
using namespace std;

int main () {
    int n;
    cin >> n;

    int res = 0;
    for (int i = 1, x; i <= n; ++ i) {
        cin >> x;
        if (i & 1) res ^= x;
    }
    cout << (res != 0 ? "Yes" : "No") << endl;
    return 0;
}
最后修改于: