OOXX Game
2015-10-29 17:40
330 查看
查看 提交 统计 提问
总时间限制: 1000ms 内存限制: 32768kB
描述
Fat brother and Maze are playing a kind of special 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.
输入
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
输出
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.
样例输入
3
1 4
OXXX
2 4
OOXX
OOXX
1 2
XX
样例输出
Case 1: Maze
Case 2: Fat brother
Case 3: Fat brother
来源
第四届福建省大学生程序设计竞赛
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int nc , i_nc , j_nc;
//cin >> nc;
scanf("%d",&nc);
for(int k = 0 ; k < nc ; k++)
{
int count = 0;
char ch;
scanf("%d %d", &i_nc , &j_nc);
for(int i = 0 ; i < i_nc ; i++)
{
for(int j = 0 ; j < j_nc ; j++)
{
cin >> ch;
if(ch == 'O')
count++;
}
}
if(count%2)
printf("Case %d: Maze \n",k + 1);
else
printf("Case %d: Fat brother \n",k + 1);
}
}
总时间限制: 1000ms 内存限制: 32768kB
描述
Fat brother and Maze are playing a kind of special 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.
输入
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
输出
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.
样例输入
3
1 4
OXXX
2 4
OOXX
OOXX
1 2
XX
样例输出
Case 1: Maze
Case 2: Fat brother
Case 3: Fat brother
来源
第四届福建省大学生程序设计竞赛
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int nc , i_nc , j_nc;
//cin >> nc;
scanf("%d",&nc);
for(int k = 0 ; k < nc ; k++)
{
int count = 0;
char ch;
scanf("%d %d", &i_nc , &j_nc);
for(int i = 0 ; i < i_nc ; i++)
{
for(int j = 0 ; j < j_nc ; j++)
{
cin >> ch;
if(ch == 'O')
count++;
}
}
if(count%2)
printf("Case %d: Maze \n",k + 1);
else
printf("Case %d: Fat brother \n",k + 1);
}
}
相关文章推荐
- 项目clean之后,R.java不见了
- 哈佛经典:管理能量,而非时间
- Populating Next Right Pointers in Each Node
- 在已有jdk7环境下安装jdk6,遇到installer:Wrapper.CreateFile failed with error 3:The system cannot find the path specified问题
- C语言文法定义及C程序的推导过程
- 马哥linux笔记--重定向
- c文法
- iOS 准确计算某个时间点距现在的时间差的代码 如"几分钟,几小时,几秒之前" ,
- thinkphp 隐藏index.php
- linux下tar 报错gzip: stdin: not in gzip format
- 欧拉函数小结
- c++ 友元函数
- web.xml里的标签是起什么作用的
- JQuery & Javascript
- 内联成员函数应放在哪
- C语言文法定义与C程序的推导过程
- Oracle 中文数据导入乱码问题解决
- xcode合并模拟器和真机静态库的编译
- 类似QQ点赞的动画效果
- C#第一节课