# 洛谷 P1199 三国游戏

https://www.luogu.org/blog/user23248/solution-p1199

 1234567891011121314151617181920 #include #include #include #include using namespace std; int n,a[501][501],maxV; int main(){     cin>>n;     for(int i=1;i<=n;i++){         for(int j=i+1;j<=n;j++){             cin>>a[i][j];             a[j][i]=a[i][j];            }     }     for(int i=1;i<=n;i++){         sort(a[i]+1,a[i]+n+1);         maxV=max(maxV,a[i][n-1]);     }     cout<<1<

# 洛谷 P1290 欧几里德的游戏

https://www.luogu.org/blog/DJCreeper/p1290-ti-xie

 1234567891011121314151617181920212223 #include #include using namespace std; void Stan(int,int); void Ollie(int,int); void Stan(int i,int j){     if(i==j||i/j>=2)cout<<"Stan wins"<=2)cout<<"Ollie wins"<>n;     for(int i=1;i<=n;i++){         int v1,v2;         cin>>v1>>v2;         if(v1

# 洛谷 P1288 取数游戏II

https://www.luogu.org/blog/user18431/solution-p1288
https://www.luogu.org/blog/fusu2333/solution-p1288

 12345678910111213141516171819202122232425262728293031 #include #include #include #include #include #define ll long long #define pii pair #define PINF 0x7fffffff #define NINF 0x80000000 using namespace std; int n, arr[22]; int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; i++)cin >> arr[i];     for (int i = 1; i <= n; i++)if (arr[i] == 0) {         if (i % 2 == 0) {             cout << "YES";             return 0;         }         break;     }     for (int i = n; i >= 1; i--)if (arr[i] == 0) {         if ((n - i + 1) % 2 == 0) {             cout << "YES";             return 0;         }         break;     }     cout << "NO"; }

# 洛谷 P1247 取火柴游戏

https://baike.baidu.com/item/Nim%E6%B8%B8%E6%88%8F/6737105?fr=aladdin
https://blog.csdn.net/kamisama123/article/details/77649118

 12345678910111213141516171819202122232425262728293031 #include #include #include #include #include #define ll long long #define pii pair #define PINF 0x7fffffff #define NINF 0x80000000 using namespace std; int k; int arr[500005]; int main() {     ios::sync_with_stdio(false);     cin >> k;     for (int i = 1; i <= k; i++)cin >> arr[i];     int re = arr[1];     for (int i = 2; i <= k; i++)re ^= arr[i];     if (re == 0) {         cout << "lose";         return 0;     }     for (int i = 1; i <= k; i++) {         if ((re^arr[i]) < arr[i]) {             cout << arr[i] - (re ^ arr[i]) << " " << i << endl;             arr[i] ^= re;             for (int i = 1; i <= k; i++)cout << arr[i] << " ";             break;         }     } }