poj 2234 Matches Game

一道典型的Nim博弈:

View Code
#include<iostream>

 #include<cstdio>

 #include<cstdlib>

 #include<algorithm>

 #include<cmath>

 #include<queue>

 #include<set>

 #include<map>

 #include<cstring>

 #include<vector>

 #include<string>

 #define LL long long

 using namespace std;

 

 int main(  )

 {

     int n,m;

     while( scanf( "%d",&n )==1 )

     {

          int s = 0;

          for( int i = 0 ; i < n ; i ++ )

          {

                scanf( "%d",&m );

                s ^= m;        

          }    

          if( s == 0 ) puts( "No" );

          else puts( "Yes" );

     }

     //system( "pause" );

     return 0;

 }

 

你可能感兴趣的:(matches)