FZU2251OOXX--简单数学题
2014-09-06 16:28
417 查看
L - OOXX Game
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status
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
31 4OXXX2 4OOXXOOXX1 2XX
Sample Output
Case 1: MazeCase 2: Fat brotherCase 3: Fat brother
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status
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
31 4OXXX2 4OOXXOOXX1 2XX
Sample Output
Case 1: MazeCase 2: Fat brotherCase 3: Fat brother
#include <iostream> #include <stdio.h> using namespace std; char s[105][105]; int main() { int T,n,m; int cnt,cas=0; scanf("%d",&T); while(T--) { cnt=0; cas++; scanf("%d%d",&n,&m); for(int i=0;i<n;i++) { getchar();//特别重要的地方,换行符的作用是先读入数据,另起一行读入字母时,若没有getchar(),则会读错 for(int j=0;j<m;j++) { scanf("%c",&s[i][j]); if(s[i][j]=='O') cnt++; } } if(cnt%2==1) printf("Case %d: Maze\n",cas); else printf("Case %d: Fat brother\n",cas); } return 0; }
相关文章推荐
- FZU -- 2282 和 DHU -- 2049 【简单错排 + 组合数学】
- 平行四边形数 FZU 2231 简单的计算数学
- FZU 2125 简单的等式 (数学+枚举)
- Problem 2125 简单的等式(FZU),,数学题。。。
- 一个计算简单数学表达式值的算法。
- 一道简单数学题!10人有11个人算错!!
- 数学之美系列五 -- 简单之美:布尔代数和搜索引擎的索引
- 数学之美系列之五:简单之美--布尔代数和搜索引擎的索引
- 有一道十分简单的数学题,但是我就是没想出来,不得以发在首页求助
- 什么是数学:对特殊的1.8进制的简单研究
- 简单语法分析-数学表达式
- 数学之美系列五 -- 简单之美:布尔代数和搜索引擎的索引
- 数学之美 系列五 – 简单之美:布尔代数和搜索引擎的索引
- 征税到底亏了谁?简单数学背后的经济学原理
- 数学之美系列五 -- 简单之美:布尔代数和搜索引擎的索引
- 数学之美系列五 之 简单之美:布尔代数和搜索引擎的索引
- 简单的小学数学题
- 有一道十分简单的数学题,但是我就是没想出来,不得以发在首页求助
- 【数学之美系列五】简单之美:布尔代数和搜索引擎的索引
- 数学之美系列五 -- 简单之美:布尔代数和搜索引擎的索引