Balanced Game HDU
来源:互联网 发布:小米机械键盘 mac 编辑:程序博客网 时间:2024/05/16 15:33
Time limit
1000 ms
Memory limit
32768 kB
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
3235
Sample Output
BadBalancedBalanced
思路:
奇数平衡,偶数不平衡。
代码:
#include <cstdio>#include <iostream>#include <algorithm>#include <cmath>#include <cstring>using namespace std;int main(){ int N; cin>>N; while(N--){ int a; scanf("%d",&a); if(a&1)printf("Balanced\n"); else printf("Bad\n"); } return 0;}
- hdu 5882 Balanced Game
- HDU 5882 Balanced Game .
- HDU 5882 Balanced Game
- Balanced Game HDU
- HDU 5882 Balanced Game [欧拉图]
- HDU 5882 Balanced Game【博弈】
- hdu 5882 Balanced Game【水题】
- HDU 5882 Balanced Game(水题)
- HDU-5882-Balanced Game 【奇偶】
- HDU 5882 Balanced Game (脑筋急转弯)
- 【HDU 5882】Balanced Game(水)
- HDU 5882 Balanced Game 分析+欧拉图
- hdoj-5882-Balanced Game
- HDU5882-Balanced Game
- 5882 Balanced Game
- hdu5882 Balanced Game 水题
- hdu5882--Balanced Game
- hdoj 5882 Balanced Game
- 取数组的最后一个元素
- lvs DR模式
- 【MyBatis】MyBatis入门
- 宁南山:中国未来的国运如何?
- Python数据结构中列表,字典,元组,集合的总结
- Balanced Game HDU
- 递归问题 D: 八皇后
- 【LeetCode】 Implement Queue by Two Stacks用栈实现队列
- Python学习笔记:文件操作
- WIN7_64 + CVE-2012-1889的分析
- 扫盲系列之负载均衡算法
- CorelDRAW程序cdr贝塞尔的应用技巧不得不学习一下
- JavaScript进阶之流程控制语句
- Leetcode之Subarray Sum Equals K问题