HDU5882
Balanced Game
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 115 Accepted Submission(s): 99
Problem Description
Recently, there is a upgraded edition of this game: rock-paper-scissors-Spock-lizard, in which there are totally five shapes. The rule is simple: scissors cuts paper; paper covers rock; rock crushes lizard; lizard poisons Spock; Spock smashes scissors; scissors decapitates lizard; lizard eats paper; paper disproves Spock; Spock vaporizes rock; and as it always has, rock crushes scissors.
Both rock-paper-scissors and rock-paper-scissors-Spock-lizard are balanced games. Because there does not exist a strategy which is better than another. In other words, if one chooses shapes randomly, the possibility he or she wins is exactly 50% no matter how the other one plays (if there is a tie, repeat this game until someone wins). Given an integer N, representing the count of shapes in a game. You need to find out if there exist a rule to make this game balanced.
Input
For each test case, there is only one line with an integer N (2≤N≤1000), as described above.
Here is the sample explanation.
In the first case, donate two shapes as A and B. There are only two kind of rules: A defeats B, or B defeats A. Obviously, in both situation, one shapes is better than another. Consequently, this game is not balanced.
In the second case, donate two shapes as A, B and C. If A defeats B, B defeats C, and C defeats A, this game is balanced. This is also the same as rock-paper-scissors.
In the third case, it is easy to set a rule according to that of rock-paper-scissors-Spock-lizard.
Output
Sample Input
Sample Output
Source
//2016.9.17
#include <iostream>
#include <cstdio> using namespace std; int main()
{
int T, n;
scanf("%d", &T);
while(T--)
{
scanf("%d", &n);
if(n&)printf("Balanced\n");
else printf("Bad\n");
} return ;
}
HDU5882的更多相关文章
- hdu5882 Balanced Game
题目链接:hdu5882 Balanced Game 题解:每种手势的攻防数一样,不难想到n为奇数时游戏平衡. #include<cstdio> #include<cstring&g ...
- 2016 ACM/ICPC Asia Regional Qingdao Online HDU5882
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5882 解法:一个点必须出度和入度相同就满足题意,所以加上本身就是判断奇偶性 #include<std ...
随机推荐
- IGeoFeatureLayer
Members All Properties Methods Inherited Non-inherited Description AnnotationProperties Annotation ...
- PAT 天梯赛 L2-004 这是二叉搜索树吗?
递归判断+建树 题目链接:https://www.patest.cn/contests/gplt/L2-004 题解 二叉搜索树的特点就是其根节点的值是位于左右子树之间的,即大于左子树的所有值,但是小 ...
- word采用尾注进行参考文献排版的一些问题
使用Word中尾注的功能可以很好地解决论文中参考文献的排序问题.方法如下: 1.光标移到要插入参考文献的地方,菜单中“插入”——“引用”——“脚注和尾注”. 2.对话框中选择“尾注”,编号方式选“自动 ...
- Python+Selenium+PhantomJS下载JavaScript异步加载网页
# -*- coding: utf-8 -*- from selenium import webdriver import selenium.webdriver.support.ui as ui fr ...
- Hibernate批量提交
的 批量插入(Batch inserts) 如果要将很多对象持久化,你必须通过经常的调用 flush() 以及稍后调用 clear() 来控制第一级缓存的大小. Session session = s ...
- frame间跳转及相关问题
body{ font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI& ...
- 安装PIL遇到的问题
配置:Win7 64位 不过折腾到最后,没有使用PIL,官方的PIL很久木有更新了,换了Pillow,是PIL的衍生吧,一直有更新,但是两者不可在同一环境共存. 1 Python version 2. ...
- (中等) POJ 1191 棋盘分割,DP。
Description 将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下的矩形棋盘共有n块矩形棋盘.(每次 ...
- (简单) POJ 1062 昂贵的聘礼,Dijkstra。
Description 年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女儿嫁给他.探险家 拿不出这么多金币,便请求酋长降 ...
- checkbox选择多数据传入后台时,怎样解析数据
<input type="checkbox" name="test" value="值1" />显示的内容<input t ...