23.Nim游戏 博弈论 ------------待复习标志------------

 

 先手必胜状态:可以走到某一个必败状态

先手必败状态:走不到任何一个必败状态

 

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main() {
 4     int n;
 5     cin >> n;
 6     int res = 0;
 7     while (n--) {
 8         int x;
 9         cin >> x;
10         res ^= x;
11     }
12     if (res) {
13         cout << "Yes" << endl;
14     } else {
15         cout << "No" << endl;
16     }
17     return 0;
18 }
原文地址:https://www.cnblogs.com/fx1998/p/13458977.html