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