OOXX Game
来源:互联网 发布:windows下nvidia smi 编辑:程序博客网 时间:2024/06/05 02:42
Think:
这次组队赛的水题。。。。
判断 O 是奇数还是偶数
然后对应输出就可以了~~~
Problem Description
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, there are N*M coins in this board with two symbol “O” or “X”. Then they take turns to choose a grid with symbol “O” and change it into “X”. The game ends when all the symbols in the board are “X”, and the one who cannot play in his (her) turns loses the game. Fat brother and Maze like this kind of OOXX game very much and play it day and night. They don’t even need a little rest after each game!
Here’s the problem: Who will win the game if both use the best strategy? You can assume that Maze always goes first.
Input
The first line of the date is an integer T, which is the number of the text cases.
Then T cases follow, each case contains two integers N and M indicate the size of the board. Then goes N line, each line with M character shows the state of the board.
1 <= T <=100, 1 <= n <=100, 1 <= m <=100
Output
For each case, output the case number first, and then output the winner’s name, either Fat brother or Maze. See the sample input and output for more details.
Sample Input
3
1 4
OXXX
2 4
OOXX
OOXX
1 2
XX
Sample Output
Case 1: Maze
Case 2: Fat brother
Case 3: Fat brother
#include<stdio.h>#include<string.h>#include <algorithm>using namespace std;int main(){ int t; int sum; int n, m; int Case = 1; scanf("%d",&t); while(t--) { scanf("%d%d", &n, &m); char c; sum = 0; getchar(); for(int i = 0; i < n;i++) { for(int j = 0; j < m; j++) { scanf("%c", &c); if(c == 'O') sum++; } getchar(); } if(sum % 2 == 0) printf("Case %d: Fat brother\n", Case++); else printf("Case %d: Maze\n", Case++); }}
- OOXX Game
- OOXX Game
- FZU 2151 OOXX Game
- FZU 2151 OOXX Game
- FZU_Problem 2151 OOXX Game
- FZU2151 OOXX Game
- FZU-2151 OOXX Game
- FZU 2151 OOXX Game
- B OOXX Game(FZU 2151)
- FZU Problem 2151 OOXX Game (数学啊)
- fzu 2146 Easy Game & 2147 A-B Game & 2151 OOXX Game(水题)
- 每天收藏点OOXX的思路
- python3 爬煎蛋ooxx妹子图
- 灭了珊瑚虫,OOXX了SOFF,下一个是谁?
- 某个OOXX网的软文,存下
- game
- game
- game
- 普通摄像头的数据输出格式YUV与mjpeg之间联系、DCT离散余弦变换去噪跟压缩
- 消息队列选型
- 【codevs 1075】明明的随机数
- 欢迎使用CSDN-markdown编辑器
- Python画图工具类库matplotlib
- OOXX Game
- [ROR]Single Table Inheritance with Rails 4 (Part 1)
- 打印输出部门结构
- 546. Remove Boxes (HARD)
- code::block 常用快捷键 (最常用)
- UTMI+/ULPI
- CART回归树的构建
- 程序员面试题之计算阶乘n!尾数0的个数
- python learning2