Balanced Game

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 297    Accepted Submission(s): 265

Problem Description
Rock-paper-scissors is a zero-sum hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper", and "scissors". The game has only three possible outcomes
other than a tie: a player who decides to play rock will beat another player who has chosen scissors ("rock crushes scissors") but will lose to one who has played paper ("paper covers rock"); a play of paper will lose to a play of scissors ("scissors cut paper").
If both players choose the same shape, the game is tied and is usually immediately replayed to break the tie.



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
The first line of input contains an integer t, the number of test cases. t test cases follow.

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
For each test cases, output "Balanced" if there exist a rule to make the game balanced, otherwise output "Bad".
 
Sample Input
3
2
3
5
 
Sample Output
Bad
Balanced
Balanced
 

题意是给n个点,问这n个点能不能组成平衡的游戏,题目说的很多,说白了就是n个点之间两两建边,能否保证每个点入度与出度相等

我们容易知道偶数个点有奇数条边与他相连,奇数个点有偶数条边与他相连,所以分奇偶判断即可

#include<cstdio>
int main()
{
int o,n;
while(~scanf("%d",&o))
{
while(o--)
{
scanf("%d",&n);
if(n%2)
printf("Balanced\n");
else
printf("Bad\n");
}
}
return 0;
}


hdu 5882 Balanced Game 2016-09-21 21:22 80人阅读 评论(0) 收藏的更多相关文章

  1. iOS 消息推送原理及实现总结 分类: ios技术 2015-03-01 09:22 70人阅读 评论(0) 收藏

    在实现消息推送之前先提及几个于推送相关概念,如下图: 1. Provider:就是为指定IOS设备应用程序提供Push的服务器,(如果IOS设备的应用程序是客户端的话,那么Provider可以理解为服 ...

  2. *** glibc detected *** malloc(): memory corruption 分类: C/C++ Linux 2015-05-14 09:22 37人阅读 评论(0) 收藏

    *** glibc detected *** malloc(): memory corruption: 0x09eab988 *** 发现是由于memset越界写引起的. 在Linux Server上 ...

  3. sscanf 函数 分类: POJ 2015-08-04 09:19 4人阅读 评论(0) 收藏

    sscanf 其实很强大 分类: 纯C技术 技术笔记 2010-03-05 16:00 12133人阅读 评论(4) 收藏 举报 正则表达式stringbuffercurlgoogle 最近在做日志分 ...

  4. 排序练习——找出前m大的数字 分类: 排序 2015-06-08 09:33 21人阅读 评论(0) 收藏

    排序练习--找出前m大的数字 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 给定n个数字,找出前m大的数字.   输入  多组输 ...

  5. windows server 2008 R2域中的DC部署 分类: AD域 Windows服务 2015-06-06 21:09 68人阅读 评论(0) 收藏

    整个晚上脑子都有点呆滞,想起申请注册好的博客还从来都不曾打理,上来添添生机.从哪里讲起呢,去年有那么一段时间整个人就陷在域里拔不出来,于是整理了一些文档,害怕自己糊里糊涂的脑子将这些东西会在一觉醒来全 ...

  6. hdu 1030 Delta-wave (C++, 0ms, explanatory comments.) 分类: hdoj 2015-06-15 12:21 45人阅读 评论(0) 收藏

    problem description http://acm.hdu.edu.cn/showproblem.php?pid=1030 #include <cstdio> #include ...

  7. hdu 1047 (big integer sum, fgets or scanf, make you func return useful infos) 分类: hdoj 2015-06-18 08:21 39人阅读 评论(0) 收藏

    errors made, boundary conditions, <= vs < , decreasing vs increasing , ++, –, '0'/'1' vs 0/1 p ...

  8. Hiking 分类: 比赛 HDU 函数 2015-08-09 21:24 3人阅读 评论(0) 收藏

    Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Subm ...

  9. Encoding 分类: HDU 2015-06-25 21:56 9人阅读 评论(0) 收藏

    Encoding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

随机推荐

  1. How to Pronounce SAY, SAYS, and SAID

    How to Pronounce SAY, SAYS, and SAID Share Tweet Share Tagged With: Comparison I’ve noticed many non ...

  2. 趣味编程:静夜思(JOOL版)

    JOOL <dependency> <groupId>org.jooq</groupId> <artifactId>jool</artifactI ...

  3. spring 3.x + hibernate4.x 实现数据延迟加载

      Spring为我们解决Hibernate的Session的关闭与开启问题. Hibernate 允许对关联对象.属性进行延迟加载,但是必须保证延迟加载的操作限于同一个 Hibernate Sess ...

  4. git实用操作21条

    1.建空目录 mkdir e:\gg 2.把该目录变成仓库 git init   //发现当前目录下多了一个.git 3.新建文件readme.txt 4.添加文件到仓库  git add readm ...

  5. Windows内置系统账户:Local system/Network service/Local Service 区别

    LocalSystem 账户  LocalSystem是预设的拥有本机所有权限的本地账户,这个账户跟通常的用户账户没有任何关联,也没有用户名和密码之类的凭证.这个服务账户可以打开注册表的HKEY_LO ...

  6. thrust

    thrust - Bing dictionary US[θrʌst]UK[θrʌst] v.刺:塞:冲:挤 n.刺:插:重点:猛推 网络推力:插入:戳 变形Plural Form:thrusts:Pr ...

  7. 【校招面试 之 C/C++】第3题 为什么要内存对齐?以及内存对齐的方式

    1.为什么要进行内存对? 参考:https://blog.csdn.net/a369000753/article/details/51188915 所谓内存对齐,是为了让内存存取更有效率而采用的一种编 ...

  8. sqlplus下 查看oracle 执行计划

    Microsoft Windows [版本 6.1.7601] 版权所有 (c) Microsoft Corporation.保留所有权利. C:\Users\zhangzheng2 SQL :: C ...

  9. SQL SERVER 和ACCESS、EXCEL的数据导入导出

    SQL SERVER 与ACCESS.EXCEL之间的数据转换SQL SERVER 和ACCESS的数据导入导出[日期:2007-05-06]     来源:Linux公社  作者:Linux 熟 悉 ...

  10. nginx常用配置说明

    nginx的主配置(nginx.conf)说明 #worker进程数量 worker_processes 1; #错误日志 error_log logs/error.log; #进程ID文件 pid ...