OOXX Game

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<cstdio>
char a[120][120];
int main()
{int t;int n,m;scanf("%d",&t);int tot = 1;while(t--){int num = 0;scanf("%d%d",&n,&m);for(int i = 0;i<n;i++)  scanf("%s",a[i]);for(int i =  0;i<n;i++){for(int j = 0;j<m;j++){if(a[i][j]=='O')num++;}}if(num%2==0)printf("Case %d: Fat brother\n",tot++);elseprintf("Case %d: Maze\n",tot++);}return 0;
}

FZU 2151 OOXX Game相关推荐

  1. fzu 2150 Fire Game 【身手BFS】

    称号:fzu 2150 Fire Game :给出一个m*n的图,'#'表示草坪,' . '表示空地,然后能够选择在随意的两个草坪格子点火.火每 1 s会向周围四个格子扩散,问选择那两个点使得燃烧全部 ...

  2. BZOJ 2151 种树(可反悔贪心,链表)【BZOJ千题计划】就图一乐

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 题目链接 https://hydro.ac/d/bzoj/p/2151 是 hydro 的 BZOJ ...

  3. FZU 1686 神龙的难题(DLX反复覆盖)

    FZU 1686 神龙的难题 题目链接 题意:中文题 思路:每个1看成列,每个位置作为左上角的矩阵看成行.dlx反复覆盖就可以 代码: #include <cstdio> #include ...

  4. FZU 1649 Prime number or not (Miller-Rabin素数测试)

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1649 题目大意:很直接,判断一个数n(2<=n<=10^18)是不是素数.   当n达到long ...

  5. FZU 2159 WuYou

    FZU 2159 题意:给你两个串,A串和B串,其中A串有些不确定.叫你求 A < B的最大A串 做法:一开始做错了.去问小坤子,他讲了一下他的思路.就是开一个 f 数组.f[i]表示从第i位开 ...

  6. FZU 1019猫捉老鼠

    A - 猫捉老鼠 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Sta ...

  7. FZU 2214 Knapsack problem(背包问题)

    Description 题目描述 Given a set of n items, each with a weight w[i] and a value v[i], determine a way t ...

  8. FZU Monthly-201903 获奖名单

    FZU Monthly-201903 获奖名单 冠军: 黄海东 S031702647 一等奖: 林闽沪 S131700309 陈华能 S221701416 二等奖: 鲍子涵 S031702646 吴少 ...

  9. Discrete Logging hunnu10590 pku2417 fzu 1352 hit 1928 zoj 1898

    以下转自:http://hi.baidu.com/aekdycoin/blog/item/b317ca18bb24334942a9ad55.html [普通Baby Step Giant Step] ...

最新文章

  1. 原创 | 一文读懂正态分布与贝塔分布
  2. 好玩的东西——一个代码片段
  3. linux中export和source的作用和区别
  4. native react 图片多选_开源一个图片组件 react-native-border-radius-image
  5. CodeForces 361B Levko and Permutation
  6. pd怎么卸载linux系统,parallels desktop11怎么卸载?parallels desktop11卸载方法
  7. bp神经网络预测未来五年数据_预测 | 未来五年以太网收发器出货将达2.75亿只
  8. phpcms调用后台上传的img图片 - 代码篇
  9. cake 简单思维题
  10. 电子元器件检测与维修从入门到精通视频教程
  11. V4L2 YUV/YCbCr格式数据 转 RGB格式数据 V4L2_PIX_FMT_NV12 转 RGB
  12. 手机怎么录游戏视频 手机屏幕录制的方法
  13. SONET、SDH、POS简介
  14. 不了心修改了/etc/sudoers原本的权限0777,进不去root,现在提供一个良好的解决办法~
  15. Lingoes安装词典和语音库
  16. 新手如何使用腾讯云云服务器详细教程
  17. 手机发出的邮件可以撤回吗?已发出的邮件撤回后对方能看到吗?
  18. 【Python】字符串不足位数补零/补空格
  19. 两次获得微信生态支持的如祺出行,如何破局网约车市场?
  20. 扫地机器人黑色耐脏吗_扫地机器人这么火?可你真的知道怎么选才不会入坑吗?...

热门文章

  1. UBUNTU创建桌面快捷图标_pycharm, jupyter notebook为例
  2. 建议收藏!Axure中用例事件与用例动作的中英文对照表
  3. SQLyog 64位破解版 v12.09中文注册版
  4. Learning Dynamic Siamese Network for Visual Object Tracking全文翻译
  5. easyconnect下载地址
  6. 最小二乘法与代价函数
  7. android知识回顾--view的事件体系
  8. JavaWeb是什么?总结一下JavaWeb的体系
  9. 项目管理专业人员能力评价(CSPM)相关问题汇总,看这篇就够了!
  10. r语言进行go富集分析_GO富集分析可视化:R语言GOplot包