巴什博弈:只有一堆n个物品,两个人轮流从这堆物品中取物, 规定每次至少取一个,最多取m个。最后取光者得胜。

结论:只要不能整除,那么必然是先手取胜,否则后手取胜。

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=,inf=; int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n,m,t;
cin>>t;
while(t--){
cin>>n>>m;
if(n%(m+)!=)cout<<"first"<<endl;
else cout<<"second"<<endl;
}
return ;
}

hdu1846巴什博弈的更多相关文章

  1. Brave Game HDU1846(巴什博弈)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1846 题目: Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电 ...

  2. HDU1846 Brave Game(巴什博弈)

    十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫<勇敢者的游戏>(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻. 今天,大家选择 ...

  3. HDU 1846 Brave Game(巴什博弈)

    题目链接: 传送门 Brave Game Time Limit: 1000MS     Memory Limit: 65536K 题目描述 各位勇敢者要玩的第一个游戏是什么呢?很简单,它是这样定义的: ...

  4. hdu 1851 尼姆+巴什博弈

    先在每堆中进行巴什博弈,然后尼姆 #include<stdio.h> int main() { int T; int i,n; int ans,m,l; scanf("%d&qu ...

  5. HD1847 Good Luck in CET-4 Everybody!(巴什博弈)

    巴什博弈: 一堆物品n个,最多取m个,最少取1个,最后取走的人获胜 分析:只要保证取玩最后剩m+1个,则必定胜利,所以构造m+1,只要n是 m+1的倍数,则先手必败,每次先手取玩,后手可取使得剩下的仍 ...

  6. hdu 4764 Stone (巴什博弈,披着狼皮的羊,小样,以为换了身皮就不认识啦)

    今天(2013/9/28)长春站,最后一场网络赛! 3~5分钟后有队伍率先发现伪装了的签到题(博弈) 思路: 与取石头的巴什博弈对比 题目要求第一个人取数字在[1,k]间的某数x,后手取x加[1,k] ...

  7. Brave Game(裸的巴什博弈)

    Brave Game Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  8. NYOJ-2359: 巴什博弈?

    2359: 巴什博弈? 时间限制: 1 Sec  内存限制: 30 MB 提交: 263  解决: 55 [提交][状态][讨论版] 题目描述 有n个石子,有两人轮流从中取石子,最少a个最多b个,谁没 ...

  9. acm--博弈入门1(巴什博弈1)--(HDU 1846 HDU 2049)

    一开始听大佬讲巴什博弈,听成巴士博弈,后来知道了巴什博弈的大名,还知道了博弈不止一种.所谓博弈,就是一场心机的对抗. 好巴什,好巴什......(记得有一个广告语是这么来着) 切入正题: 巴什博弈,问 ...

随机推荐

  1. ZOJ 3203 Light Bulb

    Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow a ...

  2. 实现VMware下CentOS和Windows之间的复制粘贴

    实现VMware下CentOS和Windows之间的复制粘贴1.第一步,打开虚拟机2.点击菜单栏中的虚拟机->安装VMware Tools3.桌面中找到VMwareTools-10.0.10-4 ...

  3. Spring Boot - Building RESTful Web Services

    Spring Boot Building RESTful Web Services https://www.tutorialspoint.com/spring_boot/spring_boot_bui ...

  4. JSON_CONTAINS

    select * from tb    where info->'$.name' = '特价促销'  or JSON_CONTAINS(info->'$[*].name', '" ...

  5. Java-idea-常用技巧-转maven,解决包依赖冲突

    1.Intellij IDEA如何将普通工程转换成maven工程 项目上右键 Add Framework Support,选择maven 2.Intellij IDEA 自动生成 serialVers ...

  6. Qt编译出错:“Cannot find file...... .pro."

    刚接触Qt,使用Qt5.7时,出现如下编译错误: 其实原因很简单,就是Qt工程目录不能有“中文”.“全角符字符”[暂时发现这两种情况].

  7. java之标记型接口Cloneable

    1.克隆用途. Cloneable和Serializable一样都是标记型接口,它们内部都没有方法和属性,implements Cloneable表示该对象能被克隆,能使用Object.clone() ...

  8. centos6 pip install python-ldap报错

    error: Setup script exited with error: command 'gcc' failed with exit status 1 解决方法: 原因是版本不兼容,centos ...

  9. Flume环境安装

    源码包下载: http://archive.apache.org/dist/flume/1.8.0/ 集群环境: master 192.168.1.99 slave1 192.168.1.100 sl ...

  10. POI之Excel导出

    1,在maven的pom文件中添加依赖 <dependency> <groupId>org.apache.poi</groupId> <artifactId& ...