Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

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

要balanced的话,需要每个形状能胜的都相同,所以(n-1)+(n-2)+....+1%n==0

 #include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
int main()
{
int t,n;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
scanf("%d",&n);
if((n-)%==)
printf("Balanced\n");
else
printf("Bad\n");
}
}
return ;
}

2016 ACM/ICPC Asia Regional Qingdao Online 1005 Balanced Game的更多相关文章

  1. 2016 ACM/ICPC Asia Regional Qingdao Online 1001/HDU5878 打表二分

    I Count Two Three Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  2. HDU 5889 Barricade 【BFS+最小割 网络流】(2016 ACM/ICPC Asia Regional Qingdao Online)

    Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  3. 2016 ACM/ICPC Asia Regional Qingdao Online(2016ACM青岛网络赛部分题解)

    2016 ACM/ICPC Asia Regional Qingdao Online(部分题解) 5878---I Count Two Three http://acm.hdu.edu.cn/show ...

  4. 2016 ACM/ICPC Asia Regional Qingdao Online

    吐槽: 群O的不是很舒服 不知道自己应该干嘛 怎样才能在团队中充分发挥自己价值 一点都不想写题 理想中的情况是想题丢给别人写 但明显滞后 一道题拖沓很久 中途出岔子又返回来搞 最放心的是微软微软妹可以 ...

  5. 【2016 ACM/ICPC Asia Regional Qingdao Online】

    [ HDU 5878 ] I Count Two Three 考虑极端,1e9就是2的30次方,3的17次方,5的12次方,7的10次方. 而且,不超过1e9的乘积不过5000多个,于是预处理出来,然 ...

  6. hdu 5878 I Count Two Three (2016 ACM/ICPC Asia Regional Qingdao Online 1001)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 题目大意: 给出一个数n ,求一个数X, X>=n. X 满足一个条件 X= 2^a*3^ ...

  7. Hdu OJ 5884-Sort (2016 ACM/ICPC Asia Regional Qingdao Online)(二分+优化哈夫曼)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5884 题目大意:有n个有序的序列,对于第i个序列有ai个元素. 现在有一个程序每次能够归并k个序列, ...

  8. 2016 ACM/ICPC Asia Regional Qingdao Online HDU5889

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5889 解法:http://blog.csdn.net/u013532224/article/details ...

  9. 2016 ACM/ICPC Asia Regional Qingdao Online HDU5883

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5883 解法:先判断是不是欧拉路,然后枚举 #pragma comment(linker, "/S ...

随机推荐

  1. SQL 语句中的union操作符

    前端时间,用到了union操作符,周末有时间总结下,w3c手册内容如下: SQL UNION操作符 UNION操作符用于合并两个或多个select语句的结果集. 注意:UNION内部select语句必 ...

  2. [新概念英语II 笔记] Lesson 3: Please Send Me a Card

    发现身边很多程序员都能看懂英文技术文章的60%-80%内容,但大家都有一个毛病,就是不会说,不会写作,在逛英文技术社区的时候,想发表点什么评论,总担心自己写的话有错误.究其原因, 我觉得主要原因是因为 ...

  3. MongoDB学习之--增删改查(2)

    昨天简单介绍了官方驱动操作MongoDB进行增删查操作的,今天继续介绍更新操作..... 方法简介 官方驱动中更新操作使用collection的Update方法,有泛型和非泛型两个版本: 其签名如下( ...

  4. C++11改进我们的程序之简化我们的程序1

    C++11改进我们的程序之简化我们的程序(一) C++11在很多方面可以简化我们的程序开发,我会在“简化我们的程序”这一系列的博文中一一讲到,敬请关注.这次要讲的是:C++11如何通过获取函数模板的返 ...

  5. 用c#实现与飞环语音卡的交互

    现在很多企业都采用freeswitch搭建的软交换来实现通话,主要优势成本低吞吐量大,但是语音卡的通话质量还是瑞胜一筹. 去年有机会在朋友公司里帮忙开发与软交换交互的上层服务及接口,在开发过程中稍微研 ...

  6. javascript语言精粹mindmap

    javascript语言精粹mindmap 最近刚刚读完<javascript语言精粹>,感觉其中的内容确实给用js作开发语言的童鞋们提了个醒——js里面坑很多啊 不过,我也并不完全认同书 ...

  7. [置顶] NS2中对TCP数据包和ACK包的TCP Sink类的主要实现代码详尽剖析--吐血放送

    NS2中对TCP数据包和ACK包的TCP Sink类的主要实现代码详尽剖析,限于个人水平,如有错误请留言指出! TcpSink类的recv()方法: void TcpSink::recv(Packet ...

  8. 用docker cluster store实现kuryr的共享subnet

    kuryr共享网络 在上一篇分享中,提到共享网络需要在10.8.65.80和10.8.65.81上分别通过docker network create来创建网络.而实际上,通过对docker源码的解读, ...

  9. IDEA maven项目创建速度慢

    1.使用的是mvn创建项目 mvn archetype:generate -DarchetypeCatalog=internal 2.使用的是IDEA创建项目 close所有project 在conf ...

  10. https时代来了,你却还一无所知?

    本文作者:茄果,专注前端开发领域,更多文章请关注知乎专栏<前端小事> 现在打开各大知名网站,你有没有发现地址栏都已经加了个绿色的小锁? 是的,这就是https,这就是https的时代. 然 ...