poj 1082 Calendar Game & HDU 1079 Calendar Game

转载:http://blog.csdn.net/cscj2010/article/details/7760858

题目大意是:

两个家伙在区域赛前夕闲的无聊,然后玩一种无限纠结的游戏,随即给定一个日期,每次只能移动day OR month..........

而且如果下一个月没有当前day的话, 你就不能移动month,比如1月31日,你只能移动day 使其到2月1日,而不能移动月让其到达2月31日,原因你懂的!

嗯,现在Adam开始YY了要!需要你来找一个必胜策略!(到达2001.11.4日就不能移动,无法移动的孩纸败

必败                  必胜

11.4                   11.3

11.2                   11.1

10.31                 10.30

…………

10.5                   10.4

…………

10.1                   9.30*******

                         9.29(可以跳到10.29)

…………

9.2                  9.1

8.31                8.30

………………

12.1              11.30*****

…………

…………

…………

可以大致看到其实胜负和年份是没有关系的说,年份影响的只是2月是否存在第29天……而29是必败点,28为必胜……

看上图……貌似必胜点 月份+日期 == 偶数 (除去两个例外)

特殊考虑那两个家伙……

View Code
#include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<algorithm>
 #include<cmath>
 #include<queue>
 #include<set>
 #include<map>
 #include<cstring>
 #include<vector>
 #include<string>
 #define LL long long
 using namespace std;
 
 int main(  )
 {
     int year,month,day,T;
     while( scanf( "%d",&T )==1 )
     {
         while( T-- )
         {
             scanf( "%d %d %d",&year ,&month ,&day );
             if( ( month + day )%2 == 0 || ( day == 30 &&( 11 == month || 9 == month ) ) )
                  puts( "YES" );
             else puts( "NO" );    
         }    
     }
     //system( "pause" );
     return 0;
 }
 

 

 

posted @ 2012-09-20 22:14  wutaoKeen  阅读(289)  评论(0编辑  收藏  举报