HDU 4642 (13.08.25)
Fliping game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 853 Accepted Submission(s): 612
1, y
1)-(n, m) (1 ≤ x
1≤n, 1≤y
1≤m) and flips all the coins (upward to downward, downward to upward) in it (i.e. flip all positions (x, y) where x
1≤x≤n, y
1≤y≤m)). The only restriction is that the top-left corner (i.e. (x
1, y
1)) must be changing from upward to downward. The game ends when all coins are downward, and the one who cannot play in his (her) turns loses the game. Here's the problem: Who will win the game if both use the best strategy? You can assume that Alice always goes first.
Then T cases follow, each case starts with two integers N and M indicate the size of the board. Then goes N line, each line with M integers shows the state of each coin, 1<=N,M<=100. 0 means that this coin is downward in the initial, 1 means that this coin is upward in the initial.
2 2
1 1
1 1
3 3
0 0 0
0 0 0
0 0 0
Bob
水题, 看最后一个数就行了, 是1, Alice赢, 是0, Bob赢~
AC代码:
#include<stdio.h> int main() {
int T;
scanf("%d", &T);
while(T--) {
int r, c;
scanf("%d %d", &r, &c);
int key;
for(int i = 0; i < r; i++)
for(int j = 0; j < c; j++)
scanf("%d", &key);
if(key == 1)
printf("Alice\n");
else
printf("Bob\n");
}
return 0;
}
HDU 4642 (13.08.25)的更多相关文章
- HDU 4287 (13.08.17)
Problem Description We all use cell phone today. And we must be familiar with the intelligent Englis ...
- UVA 10340 (13.08.25)
Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memory Limi ...
- UVA 10041 (13.08.25)
Problem C: Vito's family Background The world-known gangster Vito Deadstone is moving to New York. ...
- UVA 639 (13.08.25)
Don't Get Rooked In chess, the rook is a piece that can move any number of squaresvertically or ho ...
- hdu 4642 Fliping game
http://acm.hdu.edu.cn/showproblem.php?pid=4642 对于给定的矩阵 操作步数的奇偶性是确定的 奇数步Alice赢 否则Bob赢 从左上角向右下角遍历遇到1就进 ...
- hdu 4642 Fliping game(博弈)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4642 题意:给定一个棋盘,0表示向下,1表示向上,选一个x,y, 然后翻转从x,y 到n,m.的所有硬币, ...
- UVA 10194 (13.08.05)
:W Problem A: Football (aka Soccer) The Problem Football the most popular sport in the world (ameri ...
- 百度地图-省市县联动加载地图 分类: Demo JavaScript 2015-04-26 13:08 530人阅读 评论(0) 收藏
在平常项目中,我们会遇到这样的业务场景: 客户希望把自己的门店绘制在百度地图上,通过省.市.区的选择,然后加载不同区域下的店铺位置. 先看看效果图吧: 实现思路: 第一步:整理行政区域表: 要实现通过 ...
- Segment Tree 扫描线 分类: ACM TYPE 2014-08-29 13:08 89人阅读 评论(0) 收藏
#include<iostream> #include<cstdio> #include<algorithm> #define Max 1005 using nam ...
随机推荐
- Poj 3517 And Then There Was One(约瑟夫环变形)
简单说一下约瑟夫环:约瑟夫环是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围.从编号为k的人开始报数,数到m的那个人出列:他的下一个人又从1开始报数,数到m的那个 ...
- 当前项目与当前环境的JDK版本不匹配”Bad version number in .class file“
java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.d ...
- Problem F: Exponentiation
Problem F: ExponentiationTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 4 Solved: 2[Submit][Status][W ...
- iptables 简单配置
通过命令 netstat -tnl 可以查看当前服务器打开了哪些端口 Ssh代码 netstat -tnl 查看防火墙设置 Ssh代码 iptables -L -n 开放 ...
- centos7 ops
默认使用firewall防火墙,不在使用iptables 特点:可以动态加载新设置的规则,而不用重启服务 scp操作: scp localfile user@host:remotedir mysql. ...
- Strut2中的session和servlet中的session的区别
在jsp中,内通过内置对象 HttpServletRequest的getSession()方法可以获取到HttpSession,比如: <%@ page language="java& ...
- HTML+CSS笔记 CSS进阶续集
元素分类 在CSS中,html中的标签元素大体被分为三种不同的类型:块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的块状元素有: <div>.<p>.<h1&g ...
- IOS 使用IOS6苹果地图
IOS应用程序中使用Map Kit API开发地图应用程序.其核心是MKMapView类的使用.我们可以设置地图显示方式,控制地图,可以在地图上添加标注. 1.显示地图 在Map Kit API中显示 ...
- css 一些事
1.两个div左边的固定宽度右边的自动填充的css <div id="main" style="width:98%;"> <div id=&q ...
- 转: Nodejs概述
目录 简介 安装与更新 版本管理工具nvm 基本用法 REPL环境 异步操作 全局对象和全局变量 模块化结构 概述 核心模块 自定义模块 fs模块 Stream模式 http模块 实例:搭建一个HTT ...