FZU 2151 OOXX Game
2014-07-16 21:55
288 查看
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, the
re 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
Sample Output
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, the
re 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<cstdio> #include<cstring> using namespace std; int t,n,m; void work() { int sum=0; scanf("%d%d",&n,&m); for(int i=1;i<=n*(m+1);i++) { char a; scanf("%c",&a); if(a==79) sum++; } if(sum%2==1)printf("Maze\n"); else printf("Fat brother\n"); } int main() { freopen("lOOXXGame.in","r",stdin); freopen("lOOXXGame.out","w",stdout); scanf("%d",&t); for(int i=1;i<=t;i++) { printf("Case %d: ",i); work(); } return 0; }
相关文章推荐
- FZU Problem 2151 OOXX Game (数学啊)
- FZU2151 OOXX Game
- FZU 2151 OOXX Game
- FZU 2151 OOXX Game
- fzu 2146 Easy Game & 2147 A-B Game & 2151 OOXX Game(水题)
- FZU 2151 OOXX Game
- FZU_Problem 2151 OOXX Game
- FZU2151- OOXX Game
- fzu 2275 Game
- I - Moon Game FZU - 2148 ---几何+枚举
- FZU 2150Fire game-BFS
- FZU Fire Game(两点BFS)
- FZU-2147-2147 A-B Game,规律题。。
- FZU Easy Game
- FZU Fire Game(两点BFS)
- FZU 2150 Fire Game BFS求解
- Fire Game FZU - 2150
- fzu Problem 2275 Game(kmp)
- FZU 2275 Game (KMP)
- I - Moon Game FZU - 2148 (叉积,凸四边形)