Stone

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1136    Accepted Submission(s): 792

Problem Description
Tang and Jiang are good friends. To decide whose treat it is for dinner, they are playing a game. Specifically, Tang and Jiang will alternatively write numbers (integers) on a white board. Tang writes first, then Jiang, then again Tang, etc... Moreover, assuming that the number written in the previous round is X, the next person who plays should write a number Y such that 1 <= Y - X <= k. The person who writes a number no smaller than N first will lose the game. Note that in the first round, Tang can write a number only within range [1, k] (both inclusive). You can assume that Tang and Jiang will always be playing optimally, as they are both very smart students.
 
Input
There are multiple test cases. For each test case, there will be one line of input having two integers N (0 < N <= 10^8) and k (0 < k <= 100). Input terminates when both N and k are zero.
 
Output
For each case, print the winner's name in a single line.
 
Sample Input
1 1 30 3 10 2 0 0
 
Sample Output
Jiang Tang Jiang
 
Source
 
Recommend
liuyiding   |   We have carefully selected several similar problems for you:  5503 5502 5501 5500 5499
 

Statistic | Submit | Discuss | Note亚洲赛网络赛水题

#include<stdio.h>
int n,k;
int main(){
while(scanf("%d%d",&n,&k)!=EOF){
if(n==&&k==)
break;
int temp=(n-)%(k+);
if(temp>)
printf("Tang\n");
else
printf("Jiang\n");
}
return ;
}

hdu 4764 巴什博弈的更多相关文章

  1. HDU 4764 Stone(博弈)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 题目大意:Tang和Jiang玩石子游戏,给定n个石子,每次取[1,k]个石子,最先取完的人失败 ...

  2. hdu 1849(巴什博弈)

    Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. hdu 1846(巴什博弈)

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

  4. hdu 2897 巴什博弈变形 ***

    大意:一堆石子共有n个,A,B两人轮流从中取,每次取的石子数必须在[p,q]区间内,若剩下的石子数少于p个,当前取者必须全部取完.最后取石子的人输.给出n,p,q,问先取者是否有必胜策略? Bash博 ...

  5. HDU - 1847 巴什博弈

    思路:    0  1  2  3  4  5  6  7  8  9 10 11 12    P N  N P  N N  P N N  P N   N   P 不难发现:当n为三的倍数时,KIKI ...

  6. hdu 2147(巴什博弈+NP图)

    kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/10000 K (Java/Others)Total ...

  7. Hdu 2147 巴什博弈 PN图

    P:先手必输   N:先手必胜 PN图规则:如果一个点能转换到的所有点都是N,那么此点状态为P.若能转化到一个P,即使对手面临必输状态,此点为N. 然后找规律就行 #include<bits/s ...

  8. 2013长春网赛 1006 hdu 4764 Stone(巴什博弈)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 题意:Tang 和 Jiang 玩一个游戏,轮流写下一个数,Tang先手,第一次Tang只能写[ ...

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

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

随机推荐

  1. Django数据库创建与查询及ORM的概念

    ORM:是封装在pymysql上层的文件.他的作用是把python语句转换成sql语句,从而去数据库里操作数据.从数据库里获得的数据,经过orm转换为对象,对象可以直接调用属性获得值.orm本质是个中 ...

  2. 断言assert用法

    本文转自:http://blog.jobbole.com/76285/ 这个问题是如何在一些场景下使用断言表达式,通常会有人误用它,所以我决定写一篇文章来说明何时使用断言,什么时候不用. 为那些还不清 ...

  3. php后端程序开发学习网站梳理

    博主只列举自己经常用到的: 看教学视频:慕课网,网易云课堂,百度传课 看博文和知识点:csdn 看源码:github 刷题:codewars 学习框架:thinkphp官网 下载相关资源:csdn 看 ...

  4. Ubuntu16.04 + cuda8.0 + GTX1080安装教程

    1. 安装Ubuntu16.04 不考虑双系统,直接安装 Ubuntu16.04,从 ubuntu官方 下载64位版本: ubuntu-16.04-desktop-amd64.iso . 在MAC下制 ...

  5. Genymotion的安装与设置

    Genymotion是一款非常好用的虚拟机,利用它可以在window.Liunx或MAC系统上实现Android的模似器.对于开发人员来说,有了Android模似器,就可以在电脑上实时调试安卓app, ...

  6. Caused by: javax.el.PropertyNotFoundException: Property 'title' not found on type java.lang.String

    问题:在JSP页面显示从后台传过来的list集合数据报错. 错误信息: Caused by: javax.el.PropertyNotFoundException: Property 'title' ...

  7. Azure资源管理工具Azure PowerShell介绍

    什么是 Azure PowerShell? Azure PowerShell 是一组模块,提供用于通过 Windows PowerShell 管理 Azure 的 cmdlet.你可以使用 cmdle ...

  8. 微软爆料新型系统,Windows7,Windows10强势来袭

    本系统是10月5日最新完整版本的Windows10 安装版镜像,win10正式版,更新了重要补丁,提升应用加载速度,微软和百度今天宣布达成合作,百度成为win10 Edge浏览器中国默认主页和搜索引擎 ...

  9. 安装linux虚拟机(Ubuntu & KALI)

    VMware workstation 15.0.0 ubuntu-18.10-desktop 首先安装VMware 参考资料很多,不再赘述. 之后参考 https://www.cnblogs.com/ ...

  10. java web.xml被文件加载过程及加载顺序小结

    web.xml加载过程(步骤): 1.启动WEB项目的时候,容器(如:Tomcat)会去读它的配置文件web.xml.读两个节点: <listener></listener> ...