Adam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they played the Calendar Game, in celebration of this contest. This game consists of the dates from January 1, 1900 to November 4, 2001, the contest day. The game starts by randomly choosing a date from this interval. Then, the players, Adam and Eve, make moves in their turn with Adam moving first: Adam, Eve, Adam, Eve, etc. There is only one rule for moves and it is simple: from a current date, a player in his/her turn can move either to the next calendar date or the same day of the next month. When the next month does not have the same day, the player moves only to the next calendar date. For example, from December 19, 1924, you can move either to December 20, 1924, the next calendar date, or January 19, 1925, the same day of the next month. From January 31 2001, however, you can move only to February 1, 2001, because February 31, 2001 is invalid.

A player wins the game when he/she exactly reaches the date of November 4, 2001. If a player moves to a date after November 4, 2001, he/she looses the game.

Write a program that decides whether, given an initial date, Adam, the first mover, has a winning strategy.

For this game, you need to identify leap years, where February has 29 days. In the Gregorian calendar, leap years occur in years exactly divisible by four. So, 1993, 1994, and 1995 are not leap years, while 1992 and 1996 are leap years. Additionally, the years ending with 00 are leap years only if they are divisible by 400. So, 1700, 1800, 1900, 2100, and 2200 are not leap years, while 1600, 2000, and 2400 are leap years.

InputThe input consists of T test cases. The number of test cases (T) is given in the first line of the input. Each test case is written in a line and corresponds to an initial date. The three integers in a line, YYYY MM DD, represent the date of the DD-th day of MM-th month in the year of YYYY. Remember that initial dates are randomly chosen from the interval between January 1, 1900 and November 4, 2001. 
OutputPrint exactly one line for each test case. The line should contain the answer "YES" or "NO" to the question of whether Adam has a winning strategy against Eve. Since we have T test cases, your program should output totally T lines of "YES" or "NO". 
Sample Input

3
2001 11 3
2001 11 2
2001 10 3

Sample Output

YES
NO
NO 大意:

从当前日期,一个玩家在他可以移动到下一个日程表日期或下个月的同一天。当下个月没有同一天的时候,玩家只会移动到下一个日历日期。例如,从1924年12月19日,你可以移动到1924年12月20日,下一个日历的日期,或1925年1月19日,下一个月的同一天。但是,从2001年1月31日起,您只能移动到2001年2月1日,因为2001年2月31日是无效的。当一名选手正好到达2001年11月4日时,他就赢得了比赛。如果玩家移动到2001年11月4日之后,他就会输掉游戏。

思路:知道是找规律但是没看出来,搜题解后发现原来月加日期是偶数则赢,奇数则输,但是9.30和11.30也是赢的。当然还有一种方式就是打表。

AC Code:

#include<iostream>
using namespace std;
int main(){
int n,y,m,d;
cin>>n;
for(int i=;i<n;i++)
{
cin>>y>>m>>d;
if(m==&&d==||m==&&d==) cout<<"YES"<<endl;
else if((m+d)%==) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}

Calendar Game HDU - 1079的更多相关文章

  1. Day11-G - Calendar Game HDU - 1079

    Adam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they pl ...

  2. Hdu 1079 Calendar Game

    Problem地址:http://acm.hdu.edu.cn/showproblem.php?pid=1079 一道博弈题.刚开始想用判断P点和N点的方法来打表,但无奈不知是哪里出错,总是WA.于是 ...

  3. HDU 1079 Calendar Game(博弈找规律)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1079 题目大意:给你一个日期(包含年月日),这里我表示成year,month,day,两人轮流操作,每 ...

  4. HDU 1079 Calendar Game(简单博弈)

    Calendar Game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  5. HDU 1079 Calendar Game (博弈)

    Calendar Game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  6. HDU 1079 Calendar Game(规律博弈)

    题目链接:https://cn.vjudge.net/problem/HDU-1079 题目: Adam and Eve enter this year’s ACM International Col ...

  7. HDU 1079 Calendar Game (博弈论-sg)

    版权声明:欢迎关注我的博客,本文为博主[炒饭君]原创文章.未经博主同意不得转载 https://blog.csdn.net/a1061747415/article/details/32336485 C ...

  8. hdu 1079 Calendar Game sg函数 难度:0

    Calendar Game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  9. (step 8.2.8)hdu 1079(Calendar Game)

    题目大意是: 两个家伙在区域赛前夕闲的无聊,然后玩一种无限纠结的游戏,随即给定一个日期,每次只能移动day OR month.......... 而且如果下一个月没有当前day的话, 你就不能移动mo ...

随机推荐

  1. python 之 运算符

    Python 运算符   Python 运算符 什么是运算符? 本章节主要说明Python的运算符.举个简单的例子 4 +5 = 9 . 例子中,4和5被称为操作数,"+"号为运算 ...

  2. NOIP队内凉心互测总结(8.22update)

    8.22(结束后一天) __stdcall讲题qwq 全是CF原题 D1T1 一看像是结论题,打了下表,水过 没错就是结论题,直接暴力就好 D1T2 看起来不好做,没有AC思路 打了暴力 40分 T2 ...

  3. 深度学习课程笔记(一)CNN 卷积神经网络

    深度学习课程笔记(一)CNN 解析篇 相关资料来自:http://speech.ee.ntu.edu.tw/~tlkagk/courses_ML17_2.html 首先提到 Why CNN for I ...

  4. [HDU] 平方和与立方和

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2007 //坑:注意判断输入两个数的前后大小关系 // 用while 循环 #include<io ...

  5. [JavaScript] - replaceAll,将字符串中的字母或数字等全部替换掉的方式

    原题 function DNAtoRNA(dna) { // create a function which returns an RNA sequence from the given DNA se ...

  6. Paper Reviews and Presentations

    Copied from Advanced Computer Networks, Johns Hopkins University. Paper Reviews and Presentations Ea ...

  7. _attribute_creature

    生物属性控制表 comment 备注 Entry 生物ID,对就creature_template中entry Level 不等于0时改变等级为该值 Health 不等于0时改变生命值为该值 Atta ...

  8. 删除node_modules文件

    删除node_modules文件夹报错:路径太长,无法删除. npm install rimraf -g rimraf node_modules

  9. hdu-5707-Combine String

    题意:给你三个字符串,让你计算1 2 串和3 串是否匹配,就是3串可以分解为 1  2 串,字母顺序必须是按照1 2 串的字母前后顺序. DP代码太深奥 看不太透,这个代码比较好理解一点: #incl ...

  10. Go使用protobuf

    WIN7 + Go1.9.2+protobuf3.5.1 1.首先定义一个用于测试的proto文件test.proto,内容如下: syntax = "proto3"; packa ...