HDU 1079 calendar game

Source: Internet
Author: User

Problem address: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1079

 

A game question. At the beginning, I wanted to use the method of determining the P and N points to create a table, but I had no idea what went wrong. Wa was always used. So I read the discuss question to understand this practice.

 

There will be such a change between the day and the day: assume that it is initially a month B, and sum = a + B, then after a change, it is sum = a + B + 1, that is, the parity will change.

It can be found that November 4 is 11 + 4 = 15, that is, an odd number. When Adam obtains an even number at the beginning, Adam can change the even number to an odd number. However, Eve can only change an odd number to an even number. Until the end, Adam had the opportunity to change November 3 or October 4 to November 4.

But how many special days have an impact on it?

There are indeed, that is, November 30 and September 30, because these days are odd and can be changed to odd and (9.30-> 10.1, 11.30-> 12.1 ). If Adam still has the opportunity to get the odd number and the number of characters in the last few days, he will change the previous conclusion. For Eve, Eve has no chance to get this day, because Adam can deliberately avoid these two days (8.30-> 8.31, 9.29-> 10.29, 10.30-> 10.31, 11.29-> 12.29 ).

Therefore, we can finally determine that given a date, as long as the sum is an odd number, or 9.30 or 11.30, Adam will be able to win, otherwise it will lose.

 

Thank you for your question.Wu Shu.

The code will not be available.

HDU 1079 calendar game

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.