HDU 2176 (M heap) Stone game

Source: Internet
Author: User

Rock game (M heap) Time Limit: 3000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)


Problem descriptionm heap stone, two people take turns. it can only be retrieved from 1 heap. winner. the first accessor outputs No. the attacker wins the output of yes, and then how to obtain the child. for example, 5 heap 5, 7, 8, 9, and 10 won the winner first. When the first accessors take the first 1st times, they can take the remaining one from the eight heap, you can also take 9 out of 9 and the remaining 0 out of 10.
There are multiple input groups. 1st rows in each group are m, and m <= 200000. The next M is a non-zero positive integer. m = 0 and exits.
 
The output operator outputs No. the first accessors win the output yes, and then all the methods of the first accessors take the child 1st times. if you take several from the heap with a gravel and then the remaining B will win, then output a B. see sample output.
 
Sample Input
245 4533 6 955 7 8 9 100
 
Sample output
NoYes9 5Yes8 19 010 3



Nheim game !!!!

In the nheim game, all numbers are different or 0 is a singular trend !!!


The AC code is as follows:

#include<stdio.h>int a[200005];int main(){    int n;    int sum;    int i;    while(~scanf("%d",&n)&&n)    {        sum=0;        for(i=0;i<n;i++)        {            scanf("%d",&a[i]);            sum=sum^a[i];        }        if(sum==0)            printf("No\n");        else        {            printf("Yes\n");            for(i=0;i<n;i++)            {                if(a[i]>=(sum^a[i]))                    printf("%d %d\n",a[i],sum^a[i]);            }        }    }    return 0;}





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.