博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FZU 2151 OOXX Game
阅读量:6229 次
发布时间:2019-06-21

本文共 1738 字,大约阅读时间需要 5 分钟。

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

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
1 #include 
2 #include
3 4 int main() 5 { 6 int n,m; 7 int T,ca=1; 8 int i,j,k; 9 char s[105];10 scanf("%d",&T);11 while(T--)12 {13 int num=0;14 scanf("%d %d",&n,&m);15 for(i=1;i<=n;i++)16 {17 scanf("%s",s);18 for(j=0;j
View Code

 

转载于:https://www.cnblogs.com/cyd308/p/4771409.html

你可能感兴趣的文章
ASA防火墙基本配置
查看>>
软文真的可以帮助我们的网站吗?
查看>>
现代程序设计 作业6 - 简单而有意义的题目
查看>>
70、MSTP简介
查看>>
【VMware虚拟化解决方案】构建VMware私有云 实现ITaaS
查看>>
每天一个linux命令-mkdir
查看>>
四天精通shell编程(二)
查看>>
Linux 学习笔记_8_进程管理_2_进程管理命令
查看>>
python3中实现客户端与服务端交互发送文件
查看>>
Centos yum异常问题
查看>>
标签制作软件中如何导出标签模板为PDF文件?
查看>>
时间戳
查看>>
Jenkins的安装过程(Windows)
查看>>
程序员面试-程序设计基本概念(1)
查看>>
性能测试、负载测试、压力测试的区别
查看>>
html iframe高度自适应
查看>>
Flash Stage3D 在2D UI 界面上显示3D模型问题完美解决
查看>>
nginx日志相关的查询
查看>>
浅谈回归Regression(一)
查看>>
使用Openfiler搭建ISCSI网络存储
查看>>