HDU 3951 game coin game

Source: Internet
Author: User

Question:

One circle of coins, two people take turns. Each person can only take 1 ~ K. For example, 1, 3, 4.
How many coins and K are you going to win?

Solution:

Suppose we have 10 coins, K = 2. After the first player takes one, the second player takes the corresponding coins at the symmetric point of the circle to keep the remaining coins on both sides equal, in this way, no matter how the first player gets it, the second player only needs the same method on the other side to ensure that he is the last one to take the coin. it can also be known from the SG theorem that two games with the same SG value are defeated.

The same is true for the promotion to a larger extent. Therefore, the first player's victory may only be where N is an odd number and K is 1, or K> = n,

In other cases, the second player wins.

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.