hdu 5754 Life Winner Bo 博弈论
对于king:我是套了一个表。

如果起点是P的话,则是后手赢,否则前手赢。
车:也是画图推出来的。

马:也是推出来的,情况如图咯。

对于后:比赛时竟然推错了。QAQ最后看了题解:是个威佐夫博奕。(2,3),(4,6),(5,8)……(ak,ak+k),ak是当前没有出现过的最小正整数。k就是两个坐标的差值,从1,2,3,4……
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int ty,n,m;
int vis[];
void bo1()
{
if(n%==||m%==)
{
printf("B\n");
}
else
{
printf("G\n");
}
}
void bo2()
{
if(n==m)
{
printf("G\n");
}
else
{
printf("B\n");
}
}
void bo3()
{
if(n%==&&m%==&&n==m)
{
printf("G\n");
}
else if(n%==&&m==n-)
{
printf("B\n");
}
else if(m%==&&n==m-)
{
printf("B\n");
}
else
{
printf("D\n");
}
}
void bo4()
{
memset(vis,,sizeof(vis));
int maxn = max(n,m);
int cnt = ;
int flag = ;
for(int i=;i<=maxn;i++)
{
if(vis[i]) continue; //当前没访问过的最小正整数
int j = i+cnt;
cnt++;
vis[i] = vis[j] = ;
if(i==min(n,m)&&j==max(n,m)) flag = ;
}
if(flag) printf("G\n");
else printf("B\n");
}
int main()
{
int t;
cin>>t;
while(t--)
{
scanf("%d %d %d",&ty,&n,&m);
switch(ty)
{
case :
bo1();
break;
case :
bo2();
break;
case :
bo3();
break;
case :
bo4();
break;
}
}
return ;
}
卷珠帘
hdu 5754 Life Winner Bo 博弈论的更多相关文章
- HDU 5754 Life Winner Bo (博弈)
Life Winner Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...
- HDU 5754 Life Winner Bo 组合博弈
Life Winner Bo Problem Description Bo is a "Life Winner".He likes playing chessboard gam ...
- 【博弈论】HDU 5754 Life Winner Bo
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 题目大意: 4种棋子,象棋中的 1王,2车,3马,4后,选其一,B和G轮流走,不能往左上走,一 ...
- HDU 5754 Life Winner Bo (找规律and博弈)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5754 给你四种棋子,棋子一开始在(1,1)点,两个人B和G轮流按每种棋子的规则挪动棋子,棋子只能往右下 ...
- HDU 5754 Life Winner Bo(各类博弈大杂合)
http://acm.hdu.edu.cn/showproblem.php?pid=5754 题意: 给一个国际象棋的棋盘,起点为(1,1),终点为(n,m),现在每个棋子只能往右下方走,并且有4种不 ...
- HDU 5754 Life Winner Bo (各种博弈) 2016杭电多校联合第三场
题目:传送门 题意:一个国际象棋棋盘,有四种棋子,从(n,m)走到(1,1),走到(1,1)的人赢,先手赢输出B,后手赢输出G,平局输出D. 题解:先把从(n,m)走到(1,1)看做是从(1,1)走到 ...
- HDU 5754 Life Winner Bo
四种棋子实质上都是一样的思路: 如果某位置的棋子,它下一步可以走到的位置中 能找到有后手胜的位置,那么该位置先手必胜. 如果某位置的棋子,它下一步可以走到的位置中 全是先手胜,那么该位置后手必胜. 其 ...
- Life Winner Bo (博弈论)
kind:维持让对手处于(奇数,奇数)的状态,就能赢. rook:维持让对手处于(A,A)相等的状态,就能赢. knight:画图找规律,没有到达终点的就是平局. queen:威佐夫博弈论,终点不一样 ...
- HDU 5754Life Winner Bo
Life Winner Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...
随机推荐
- hdu_3062_Party(2-SAT)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3062/ 题意:2-SAT的裸题 题解:直接上模版 #include<cstdio> #in ...
- 开始制作国产的 scratch
首先分析下API和数据格式: https://api.scratch.mit.edu/proxy/featured GET 23.235.37.162:443 返回数据与对应栏目: commun ...
- phpStorm 2016.1.2 最新版激活方法【亲测可用】
测试日期:2016-07-29 下载地址:https://yunpan.cn/c6mWAGbExcyjf 访问密码 00fb 1.windows版本 菜单help >>>> ...
- linq中的分组和排序
一.分组 group 组内成员 by 分组条件 into 组的信息 class Program { static void Main(string[] args) { string[] name = ...
- go share library
http://blog.ralch.com/tutorial/golang-sharing-libraries/ Sharing Golang packages to C and Go Sun, Au ...
- Sublime console installation instructions install Package Control
instructions: import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1 ...
- 初次stack-overflow 提交答案
初次在stack-overflow上面提交答案,首先编辑器非常好用,语法检查都有, 还有付费版的,更高级,更好用,nice. 付费版:https://www.grammarly.com/upgrade ...
- liunx 平台下软件包管理
RPM/DPKG 两大阵营简介 在 GNU/Linux( 以下简称 Linux) 操作系统中,RPM 和 DPKG 为最常见的两类软件包管理工具,他们分别应用于基于 RPM 软件包的 Linux 发行 ...
- BCDBOOT命令参数介绍
BCDboot 命令行选项 更新时间: 2013年10月 应用到: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R ...
- js框架——angular.js(6)
1. ng-class 这个指令是用来绑定一个或者多个css代码.它的值一般是一个表达式,也可以是函数什么的,只要返回的确实是一个类的名字就可以—— ng-class="nextPageDi ...