n Pile up , Take at least one at a time , The rest can be divided into two piles . The last one to win loses

Watch and see Nim The game is the same ... bare Anti-SG ah

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=1e6;
inline int read(){
char c=getchar();int x=,f=;
return x*f;
int n,a;
int main(){
int sg=,flag=;
for(int i=;i<=n;i++) a=read(),sg^=a,flag|=a>;
if( (sg== && !flag) || (sg!= && flag) ) puts("Yes");
else puts("No");

HDU Be the Winner [Anti-SG] More articles about

  1. HDU 5754 Life Winner Bo ( game )

    Life Winner Bo Topic link : http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...

  2. HDU 1729 class NIM seek SG

    Every time n Boxes , Each box has a capacity limit , You can put stones in each operation , The quantity is not more than the square of the quantity in the current box , No operator can input . A box is a sub game . For a box, its capacity is s, The current number of stones is x, So if there is a Satisfy $a \t ...

  3. HDU 3980 Paint Chain (sg function )

    Paint Chain Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  4. hdu 1907 John (anti—Nim)

    John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)http://acm.h ...

  5. HDU 5754 Life Winner Bo Combinatorial game

    Life Winner Bo Problem Description   Bo is a "Life Winner".He likes playing chessboard gam ...

  6. HDU 1729 Stone Game【SG function 】

    The following is reproduced to : Zhao Xiaozhou's game theory of Changchun University of technology ppt The main idea of the topic : 1. Yes n Boxes , Every box has its capacity s 2. At the beginning of the game , There are some stones in each box 3. Both sides take turns playing the game , Put... Into a box n A stone , among n It can't be greater than when ...

  7. HDU 5724 Chess ( State compression sg Function game ) 2016 Hangdian multi school joint first

    subject : Portal . The question : Yes n That's ok , The most in each line 20 A chess piece , For a piece of chess , If he doesn't have a piece on his right , You can move to his right : If there are pieces , Just skip these pieces and move to the space behind , People who can't move lose . Answer key : State compression game , For a line 2^ ...

  8. HDU 5754 Life Winner Bo ( Looking for a regular and game )

    Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=5754 Here are four pieces , The chess pieces were in the beginning (1,1) spot , Two people B and G Move the pieces according to the rules of each piece in turn , The pieces can only go down to the right ...

  9. 【 Game theory 】HDU 5754 Life Winner Bo

    Topic link : http://acm.hdu.edu.cn/showproblem.php?pid=5754 The main idea of the topic : 4 Grow chess pieces , In chess 1 king ,2 vehicle ,3 Horse ,4 after , Choose one ,B and G Take turns , You can't go up left , One ...

  10. hdu 1536 S-Nim ( Simple sg function )

    The question : First type K Represents the size of a set   Then enter the set It means that for the pair of stones, only the number of elements in the set can be removed After input   One m Indicates that the next step for this collection is m Time to ask after m That's ok Enter one per line n Express n Heaps   Every time ...

Random recommendation

  1. poj2369 Permutations —— Permutation group

    link:http://poj.org/problem?id=2369 Permutation group , The simplest kind . Find the least common multiple of all the cyclic sections of a number . /* ID: zypz4571 LANG: C++ TASK: perm ...

  2. ax Example of error handling for

    #OCCRetryCount ; try { ttsbegin; //example as insert or update or delete record ttscommit; } catch(E ...

  3. install MSITVPN Pop up when connecting : need ( Unknown ) File on &#39;MSITVPN.bmp.

    Use msitvpn Connect microsoft Company intranet , In the installation msitvpn A dialog box will pop up to prompt you to msitvpn.bmp file , I haven't found a solution for a long time . Finally, we can only guess whether it is the user's permission or not ...

  4. window2008 64 The bit system doesn't have office Component problem analysis and solution

    Server is windows server2008 64 Bit system , I need to use my system Microsoft.Office.Interop.Excel Components Upload on Excel The document encountered an error : retrieval COM Class factory CL ...

  5. Windows How to install and configure Snort Video tutorial

    Windows How to install and configure Snort Video tutorial : First step : http://www.tudou.com/programs/view/UUbIQCng360/ Second parts : http://www.tudou ...

  6. In a formal production environment hadoop Clustered DNS+NFS+ssh Exemption password Login configuration

    Blog address :http://www.loveweir.com/ Environment virtual machine centos6.5 Host name h1  IP   As DNS FNS Of server Host name h2  IP 19 ...

  7. Codeforces Round #277.5 (Div. 2)B——BerSU Ball

    B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  8. CentOs 6.x upgrade Python edition 【 turn 】

    stay CentOS 6.X The above installation Python 2.7.X CentOS 6.X Self contained python The version is 2.6 , Due to the need of work , A lot of times 2.7 edition . So we need to upgrade the version . Because of some system tools and services ...

  9. Effective STL Learning notes : multi-purpose vector &amp; string

    Effective STL Learning notes : multi-purpose vector & string If possible , Try to avoid writing dynamically allocated arrays by yourself , Switch to vector and string . The only thing that the author of the original book thought of ...

  10. HDU 6342 Expression in Memories( simulation ) Multiple proofreading

    The question : Here's a rule for you , Ask if you wrote it right . Ideas : The general rule is : Leading zeros cannot appear , Both sides of the symbol must be legal numbers . Let's change all the question marks first , To judge whether it's legal or not , It's easier to think than to judge while changing . In the following explanation, the question mark is only changed to + ...