HDU1849 Rabbit and Grass (Nim finishing)

Source: Internet
Author: User

This kind of problem is that there are n heaps of things, each time you can take any heap of any

The last to be taken out of the winning

is to read the n heap in all the different or, not equal to 0 win

/************************************************author:d evilcreated time:2016/5/29 11:19:41***************** ******************************* */#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<vector>#include<queue>#include<Set>#include<assert.h>#include<map>#include<string>#include<cmath>#include<stdlib.h>using namespacestd;intMain () {//freopen ("In.txt", "R", stdin);    intN;  while(~SCANF ("%d", &n) &&N) {intx,ans=0;  while(n--) {scanf ("%d",&x); Ans^=x; }        if(ANS) printf ("Rabbit win!\n"); Elseprintf"Grass win!\n"); }    return 0;}

HDU1849 Rabbit and Grass (Nim finishing)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.