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 & ...
随机推荐
- 1. 星际争霸之php面向对象(一)
题记==============================================================================本php设计模式专辑来源于博客(jymo ...
- linux中模块的相关操作
/lib/modules/[kernel版本]/modules.dep 这个文件记录了模块的依赖关系 modprobe 和 insmod 这两个命令都可以加载模块,但是modeprobe会自动分析模块 ...
- NOIP200503采药
NOIP200503采药 [问题描述] 辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师.为此,他想拜附近最有威望的医师为师.医师为了判断他的资质, ...
- Android相对布局实例
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...
- ubuntu下搭建nagios
基本参考 http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html,直接apt-get install的话应该更快.要监控url,参考 ...
- Linux workqueue工作原理 【转】
转自:http://blog.chinaunix.net/uid-21977330-id-3754719.html 转自:http://bgutech.blog.163.com/blog/static ...
- Android使用Application总结
对于application的使用,一般是 在Android源码中对他的描述是; * Base class for those who need to maintain global applicati ...
- jQuery 文档操作方法(w3school)
这些方法对于 XML 文档和 HTML 文档均是适用的,除了:html(). 方法 描述 addClass() 向匹配的元素添加指定的类名. after() 在匹配的元素之后插入内容. append( ...
- 【jqGrid for ASP.NET MVC Documentation】.学习笔记.6.分层
1 两级分层 每个父 grid 的行,都能有子 grid .这被叫做 层次,它用来显示相关的 表,主信息 –> 明细信息等. } 一旦你为 父子 grid 都定义了 Models ,下一步就是设 ...
- linux ll 命令各列的含义
linux ll 命令各列的含义: