TOJ 4079 find the princessII(简单博弈)
来源:互联网 发布:知乎 勇士 编辑:程序博客网 时间:2024/06/08 10:19
Time Limit: 1.0 Seconds Memory Limit:65536K
Total Runs: 255 Accepted Runs:179
After Dsir through the "find the princessI". He came to the front door. He must go through this door can save the princess. But there is a combination lock the door. On the door there is a problem, can open the door only correct answer. This problem is that there were two smart people, Hacb and GDRTOP. They are very clever. They're playing a game, There are n sticks. They take turns to take stick.The loser is who took away the last stick. There are some rules: if there are n sticks, players can only take x sticks. Pay attention to n % x = 0.
In this game, Hacb always first take the stick.
Input
There are some cases. Each line of input n. (the number of the sticks)
Output
output "H" if Hacb win , Otherwise, output "G".
Sample Input
12
Sample Output
GH
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<cstdlib>using namespace std;int main(){int n;while(~scanf("%d",&n)){if(n%2==0){printf("H\n");}else printf("G\n");}return 0;}
- TOJ 4079 find the princessII(简单博弈)
- TOJ 4078 find the princessI(模拟)
- TOJ 2429 Find the Clones
- TOJ 2968. Find the Diagonal
- TOJ 4115 Find the number
- TOJ 4080 find the princessIII(圆和直线相交)
- 博弈(alpha-beta 剪枝)—— POJ 1568 Find the Winning Move
- TOJ 1868.Count the factors(埃式筛法)
- TOJ 1301.The Trip(精度题)
- TOJ 3105.A Way To Find Primes(埃式筛法)
- LightOJ1020(简单博弈)
- hdu 2509 - Be the Winner(简单博弈)
- LeetCode389. Find the Difference简单
- POJ 1426 Find The Multiple(简单深搜)
- hdu1596 find the safest road(DijKstra模板简单变形)
- TOJ 1782.The jackpot
- TOJ 2917.The Watchman
- TOJ 3517 The longest athletic track(树直径)
- Android中的动画(二)LayoutAnimation
- Android学习(八)AutoCompleteTextView控件
- 编译安装git
- 《软件随想录-Joel on Software》书摘
- 推荐算法——基于用户的协同过滤算法
- TOJ 4079 find the princessII(简单博弈)
- 戴尔服务器设置的来电自动开机,如何取消这个设置??
- RabbitMQ (三)工作队列
- 二位数组与二级指针的错误赋值
- React学习(八)this.state
- Java中继承的一点小知识
- css三大特性
- Ubuntu 下安装sparklyr 并连接远程spark集群
- ActiveMQ