FZU 2151 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
Sample Output
#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的更多相关文章
- FZU 2150 Fire Game
Fire Game Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit St ...
- ACM: FZU 2150 Fire Game - DFS+BFS+枝剪 或者 纯BFS+枝剪
FZU 2150 Fire Game Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u ...
- FZU 2144 Shooting Game
Shooting Game Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submi ...
- (FZU 2150) Fire Game (bfs)
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2150 Problem Description Fat brother and Maze are playing ...
- FZU 2150 Fire Game(点火游戏)
FZU 2150 Fire Game(点火游戏) Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description - 题目描述 ...
- (广搜)Fire Game -- FZU -- 2150
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82828#problem/I Fire Game Time Limit:1000MS ...
- FZU 2137 奇异字符串 后缀树组+RMQ
题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...
- FZU 1914 单调队列
题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...
- ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】
FZU 2105 Digits Count Time Limit:10000MS Memory Limit:262144KB 64bit IO Format:%I64d & ...
随机推荐
- 夺命雷公狗---Thinkphp----16之首页的完成及全站的完成
刚才我们首页只是完成了一部分的数据,那么这里我们就来将他所以的完成: IndexController.class.php控制器代码如下所示: <?php namespace Home\Contr ...
- [div+css]竖排菜单
} #box{ width:120px; font-size: 12px; font- ...
- 关于IE6/7的 inline-block
今天在写代码的时候使用了inline-block,但是很意外的在IE6/7下此属性不给力~~ 但是由于我既需要他是个内联数据,又要设置它的宽度设置block,所以只能使用inline-block. 所 ...
- 《REWORK》启示录 发出你的心声——程序员与身体
Sound Like You 所谓的标题在这里并不是为了吸引眼球,不过也是为了吸引眼球,只是出发点已经不一样了.这是一篇适合给程序员看的关于健康的文章,也许你认识李开复也可以给他看看,上过养生过,觉得 ...
- Mongodb 笔记06 副本集的组成、从应用程序连接副本集、管理
副本集的组成 1. 同步:MongoDB的复制功能是使用操作日志oplog实现的,操作日志包含了主节点的每一次写操作.oplog是主节点的local数据库中的一个固定集合.备份节点通过查询整个集合就可 ...
- Linux workqueue工作原理 【转】
转自:http://blog.chinaunix.net/uid-21977330-id-3754719.html 转自:http://bgutech.blog.163.com/blog/static ...
- 【Pro ASP.NET MVC 3 Framework】.学习笔记.12.ASP.NET MVC3的细节:URLs,Routing和Areas
Adam Applied ASP.NET 4 in Context 1 介绍Routing系统 在引入MVC之前,ASP.NET假定被请求的URLs和服务器硬盘上的文件之间有着直接关系.服务器的任务是 ...
- memcached启动参数
memcached启动参数描述: -d :启动一个守护进程, -m:分配给Memcache使用的内存数量,单位是MB,默认是64MB, -u :运行Memcache的用户 -l :监听的服务器IP地址 ...
- AVAudioplayer时error解决 创建失败 ERror creating player: Error Domain=NSOSStatusErrorDomain Code=2003334207 "(null)"
AVAudioplayer 有两个初始化方法: 1.[[AVAudioPlayer alloc] initWithData:musicData error&e]; 2.[[AVAudioPla ...
- ectouch第三讲之加载调用机制
加载与调用机制: 当地址栏键入/mobile,就会加载入口文件index.php:从入口文件里面会调用EcTouch.php公共入口文件,当进入公共入口文件,会定义一些变量,然后加载公 ...