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 ...
随机推荐
- POJ 2482 Stars in Your Window
线段树+离散化+扫描线 AC之后,又认真读了一遍题目,好文章. #include<cstdio> #include<map> #include<algorithm> ...
- Android Camera HAL浅析
1.Camera成像原理介绍 Camera工作流程图 Camera的成像原理可以简单概括如下: 景物(SCENE)通过镜头(LENS)生成的光学图像投射到图像传感器(Sensor)表面上,然后转为电信 ...
- (简单) POJ 1502 MPI Maelstrom,Dijkstra。
Description BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odysse ...
- myeclipse的常用快捷键
创建一个类 Alt+Shift+N,C,输入Demo,回车 创建类属性 按3次下方向键,回车,输入String name;,回车 创建构造器 Alt+Shift+S,O,回车 创建getter/set ...
- IOS中单例NSUserDefaults的使用(转)
一.了解NSUserDefaults以及它可以直接存储的类型 http://my.oschina.net/u/1245365/blog/294449 NSUserDefaults是一个单例,在整个程序 ...
- SQLite用法
SQLite语法:http://blog.csdn.net/ejzhang/article/details/6224915#08 SQLite查询优化:1.http://www.eoeandroid. ...
- 一个异步任务接收两个url下载两个图片
有两个url,一个是下载用户头像的url,一个是下载用户上传图片的url,想要用一个异步任务同时下载这两个图片. 程序的下载任务是这么执行的,先接受url参数,然后调用 imgUrls = infoP ...
- TFS2013 升级至TFS2015及项目的创建
TFS2015已发布想体验下新特性 由于现有数据库已经是SQLSERVER2012 SP1 开发工具VS2013 都符合升级要求 现在体验下吧 1.先下载TFS2015 运行安装向导一路NEXT 直至 ...
- php中字符串长度和截取的函数
在做PHP开发的时候,由于我国的语言环境问题,所以我们常常需要对中文进行处理. 在PHP中,我们都知道有专门的mb_substr和mb_strlen函数,可以对中文进行截取和计算长度,但是,由于这些函 ...
- Hibernate的一些事儿
一.Hibernate的工作原理: 1.读取并解析配置文件 2.读取并解析映射信息,创建SessionFactory 3.打开Sesssion 4.创建事务Transation 5.持久化操作 6.提 ...