HDOJ1079Calendar Game (找规律博弈)
来源:互联网 发布:自动对下联软件 编辑:程序博客网 时间:2024/05/18 00:53
其实这道题从找规律这方面来考虑的话还是比较容易一点的
题目大意是:
两个家伙在区域赛前夕闲的无聊,然后玩一种无限纠结的游戏,随即给定一个日期,每次只能移动day OR month而且如果下一个月没有当前day的话 , 你就不能移动month,比如1月31日,你只能移动day 使其到2月1日,而不能移动月让其到达2月31日嗯,现在Adam需要你来找一个必胜策略 !到达 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
…………
这样的话,我们可以看出,通过一年的周期循环,可以得到胜态和年份木有关系,可以看到比胜态的月份+日子为偶数(除过两个特殊的9.30和11.30),所以我们就可以这样写咯
#include <iostream>#include <cstdio>#include <string>#include <string.h>#include <map>#include <vector>#include <cstdlib>#include <cmath>#include <algorithm>#include <cmath>#include <queue>#include <set>#include <stack>using namespace std;int min(int a, int b){ if(a<=b) return a; return b;}int max(int a, int b){ if(a>=b) return a; return b;}double min(double a, double b){ if(a<=b) return a; return b;}double max(double a, double b){ if(a>=b) return a; return b;}int main(){ int y , m, d; int t; scanf("%d", &t); while(t--) { scanf("%d%d%d", &y, &m, &d); if((m+d)%2==0 || (d==30&& (m==9||m==11))) printf("YES\n"); else printf("NO\n"); } return 0;}不过标准的PN分析还没有看懂呢,我找了一个大家可以去看看,
http://blog.csdn.net/surfacedust/article/details/6687946
- HDOJ1079Calendar Game (找规律博弈)
- HDOJ1564Play a game(找规律博弈)
- Calendar Game(找规律+博弈)
- 【博弈+找规律】HDU_4642_Fliping game
- [HDU](2147)kiki's game ---找规律博弈(博弈)
- ZOJ2686 Cycle Game (博弈,找规律,搜索)
- ZOJ 2686 Cycle Game(博弈 找规律)
- 【HDU】2147 kiki's game (博弈 找规律)
- hdu 2147 kiki's game(博弈,找规律)
- POJ 2505 A multiplication game(找规律博弈)
- POJ 2348 Euclid's Game (博弈找规律 )
- HDU 1564-Play a game(博弈-找规律)
- hdu1564——Play a game(找规律博弈)
- HDU 1079 Calendar Game(博弈找规律)
- HDU 1564 Play a game(博弈找规律)
- HDU 1525 Euclid's Game (博弈、找规律)*
- HDU 1564 Play a game (博弈、找规律)
- HDU 3389 Game (阶梯博弈、找规律)*
- POJ 3162(TreeDP+单调队列)Walking Race
- BMP图像存储格式
- 使用jdbc连接oracle数据库
- 自动化测试的认识
- APUE源码安装与使用
- HDOJ1079Calendar Game (找规律博弈)
- knockoutjs的学习
- css background 各种属性
- gcc,g++
- DevComponents.DotNetBar2.dll设置样式的使用
- Ubuntu取消mysql开机自启动
- 头文件冲突问题
- QLabel几种小技巧
- 查看数据库连接池使用情况