FZU Problem 2151 OOXX Game (数学啊)
来源:互联网 发布:php判断是否微信浏览器 编辑:程序博客网 时间:2024/05/17 01:10
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2151
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
Sample Output
代码如下:
#include <cstdio>const int maxn = 117;char mm[maxn][maxn];int main(){ int n,m; int t; int cas = 0; scanf("%d",&t); while(t--) { int k = 0; scanf("%d%d",&n,&m); for(int i = 0; i < n; i++) scanf("%s",mm[i]); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { if(mm[i][j]=='O') k++; } } printf("Case %d: ",++cas); if(k%2==0) printf("Fat brother\n"); else printf("Maze\n"); } return 0;}
- FZU Problem 2151 OOXX Game (数学啊)
- FZU 2151 OOXX Game
- FZU 2151 OOXX Game
- FZU-2151 OOXX Game
- FZU 2151 OOXX Game
- B OOXX Game(FZU 2151)
- fzu 2146 Easy Game & 2147 A-B Game & 2151 OOXX Game(水题)
- FZU Problem 2147 A-B Game (数学啊)
- FZU Problem 2146 Easy Game ( 数学啊)
- FZU_Problem 2151 OOXX Game
- FZU Problem 2110 Star (数学啊 )
- FZU Problem 2104 Floor problem (数学啊 )
- OOXX Game
- OOXX Game
- FZU Problem 2150 Fire Game (双起点BFS啊 )
- FZU Problem 2102 Solve equation (数学啊 )
- FZU Problem 2111 Min Number (数学啊 )
- FZU Problem 2144 Shooting Game
- 素数判定方法_Miller-Rabbin测试
- ios开发常见错误
- 16. Dubbo原理解析-集群&容错之router路由服务
- CentOS 7.0 下 源码编译安装PostgreSQL
- mybatis自增主键配置
- FZU Problem 2151 OOXX Game (数学啊)
- Android实现记事本项目完整实例,附源代码
- FTP连接时出现“227 Entering Passive Mode” 的解决方法
- 封装和继承
- 检查代码
- ListView嵌套ScrollView后,设置dividerHeight属性后高度计算
- 17. Dubbo原理解析-集群&容错之负载均衡
- 分享18个常用的网站性能测试工具
- Linux与JVM的内存关系分析