HDU 5011 Game (Xi'an cyber competition E), hdu5011

Source: Internet
Author: User

HDU 5011 Game (Xi'an cyber competition E), hdu5011
HDU 5011 Game

Question Link

Idea: in fact, just ask for a Nim sum, and it is not difficult to push it. The sum of 0 must be a winning state, because at least one is taken away and the score cannot reach the original value, if it is a non-zero value, it is the same as the original Nim, so that it can take a bunch of numbers to make it 0.

Code:

# Include <cstdio> # include <cstring> const int N = 100005; int n; long a, sum; int main () {while (~ Scanf ("% d", & n) {sum = 0; for (int I = 0; I <n; I ++) {scanf ("% I64d ", & a); sum ^ = a;} if (sum = 0) printf ("Lose \ n"); else printf ("Win \ n ");} return 0 ;}





Related Article

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.