OOXX Game

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

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> int main()
{
int n,m;
int T,ca=;
int i,j,k;
char s[];
scanf("%d",&T);
while(T--)
{
int num=;
scanf("%d %d",&n,&m);
for(i=;i<=n;i++)
{
scanf("%s",s);
for(j=;j<m;j++)
if(s[j]=='O')
num++;
}
printf("Case %d: ",ca);
if(num%==)
printf("Fat brother\n");
else
printf("Maze\n");
ca++;
}
return ;
}

FZU 2151 OOXX Game的更多相关文章

  1. FZU 2150 Fire Game

    Fire Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit St ...

  2. ACM: FZU 2150 Fire Game - DFS+BFS+枝剪 或者 纯BFS+枝剪

    FZU 2150 Fire Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u ...

  3. FZU 2144 Shooting Game

    Shooting Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submi ...

  4. (FZU 2150) Fire Game (bfs)

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=2150 Problem Description Fat brother and Maze are playing ...

  5. FZU 2150 Fire Game(点火游戏)

    FZU 2150 Fire Game(点火游戏) Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description - 题目描述 ...

  6. (广搜)Fire Game -- FZU -- 2150

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/I Fire Game Time Limit:1000MS    ...

  7. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  8. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

  9. ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】

     FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

随机推荐

  1. 夺命雷公狗---DEDECMS----17dedecms头条信息的取出

    我们在有些开发时候可能会用到些头条的文章,,添加过程如下所示: 我们在前台遍历数据的时候可以这样, 然后在后台更新首页模版后在去看下首页,效果如下所示:

  2. 【rails3教材】博客构建过程

    构建rails项目--blog $ rails new blog --skip-bundle $ cd blog $ bundle --local $ bundle install #安装需要的包 $ ...

  3. 【转】“C语言说到底是一门以内存为中心的编程语言” —— 这种说法正确吗?

    转自:http://weibo.com/1005903613/AAgqA3kb4  LAW张粑粑的微博

  4. hibernate笔记02

  5. SQL SERVER2012秘钥

    来自网络: MICROSOFT SQL SERVER 2012 DEVELOPER 版(开发版)序列号:YQWTX-G8T4R-QW4XX-BVH62-GP68YMICROSOFT SQL SERVE ...

  6. android 学习随笔十一(网络:HttpClient框架)

    1.使用HttpClient框架发送get.post请求 google收集apache提供的一个发送Http请求框架 public class Tools { public static String ...

  7. json校验

    直接百度:json在线解析  或  json.cnhttp://json.cn/ json格式校验的.这个更加简洁些.

  8. HAL中通过JNI调用java方法【转】

    转载请注明本文出处:http://www.cnblogs.com/xl19862005 作者:Xandy 由于工作的需要,最近一直在研究HAL.JNI.Java方法之间互调的问题,并做了如下一些记录和 ...

  9. 14 个 grep 命令的例子 【转】

    转自:https://linux.cn/article-5453-1.html 编译自:http://www.linuxtechi.com/linux-grep-command-with-14-dif ...

  10. php中urlencode与rawurlencode的区别有那些呢

    urlencode 函数: 返回字符串,此字符串中除了 -_. 之外的所有非字母数字字符都将被替换成百分号(%)后跟两位十六进制数,空格则编码为加号(+).此编码与 WWW 表单 POST 数据的编码 ...