HDU 4642 Fliping game (2013多校4 1011 简单博弈)
Fliping game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 46 Accepted Submission(s): 35
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
和翻硬币那个很类似。
简单的博弈,找规律发现只有最右下角的SG值为1,其余的都为0;
所以所有1的SG值异或的结果取决于最右下角的。
只有右下角为1,输出Alice,否则输出Bob
- /*
- * Author:kuangbin
- * 1011.cpp
- */
- #include <stdio.h>
- #include <algorithm>
- #include <string.h>
- #include <iostream>
- #include <map>
- #include <vector>
- #include <queue>
- #include <set>
- #include <string>
- #include <math.h>
- using namespace std;
- int main()
- {
- //freopen("in.txt","r",stdin);
- // freopen("out.txt","w",stdout);
- int T;
- int a;
- scanf("%d",&T);
- while(T--)
- {
- int sum = ;
- int n,m;
- scanf("%d%d",&n,&m);
- for(int i = ;i <= n;i++)
- for(int j = ;j <= m;j++)
- {
- scanf("%d",&a);
- }
- if(a)printf("Alice\n");
- else printf("Bob\n");
- }
- return ;
- }
HDU 4642 Fliping game (2013多校4 1011 简单博弈)的更多相关文章
- HDU 4678 Mine (2013多校8 1003题 博弈)
Mine Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submis ...
- HDU 4665 Unshuffle (2013多校6 1011 )
Unshuffle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- HDU 4705 Y (2013多校10,1010题,简单树形DP)
Y Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submiss ...
- HDU 4704 Sum (2013多校10,1009题)
Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submi ...
- HDU 4699 Editor (2013多校10,1004题)
Editor Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Su ...
- HDU 4696 Answers (2013多校10,1001题 )
Answers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total S ...
- HDU 4690 EBCDIC (2013多校 1005题 胡搞题)
EBCDIC Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Su ...
- HDU 4681 String(2013多校8 1006题 DP)
String Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Subm ...
- HDU 4666 Hyperspace (2013多校7 1001题 最远曼哈顿距离)
Hyperspace Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Tota ...
随机推荐
- linux内核启动分析(3)
主要分析do_basic_setup函数里面的do_initcalls()函数,这个函数用来调用所有编译内核的驱动模块中的初始化函数. static void __init do_initcalls( ...
- Django2.0如何配置urls文件
刚开始学django,创建的第一个工程无法启动,后来发现是由于教程是针对较低版本的Django,我用的是Django2.0和Python3.6,两个都是发文为止的最新版本,urls文件设置方法和旧版本 ...
- win10出现"win10系统即将过期,请激活"的处理办法
当打开电脑时,出现"你的win10系统即将过期,请前往激活”的提示.上网查了解决方案,避免以后在出现这样的情况,现将解决步骤整理如下: 1.下载KMSpico激活软件,百度网盘下载链接如下: ...
- JVM字节码执行引擎和动态绑定原理
1.执行引擎 所有Java虚拟机的执行引擎都是一致的: 输入的是字节码文件,处理过程就是解析过程,最后输出执行结果. 在整个过程不同的数据在不同的结构中进行处理. 2.栈帧 jvm进行方法调用和方法执 ...
- LeetCode解题报告—— Rotate List & Set Matrix Zeroes & Sort Colors
1. Rotate List Given a list, rotate the list to the right by k places, where k is non-negative. Exam ...
- JS将日期转换为yyyy-MM-dd HH:mm:ss
//格式化后日期为:yyyy-MM-dd HH:mm:ss function FormatAllDate(sDate) { var date = new Date(sDate); var sepera ...
- es6数组必看太实用了
随着前后分离,前端人员也要写大量的逻辑代码,es5很多地方尤其是数据工具大拿数组,很多时候都是捉襟见肘. 继而,es6为我们扩展了很多good的工具和方法,让我们一起学习es6吧. 1原型方法from ...
- macos不能打开windows samba共享问题(转载)
转自:https://www.macx.cn/thread-2095377-1-1.html?mod=viewthread&tid=2095377&extra=page%253D1&a ...
- 转:西部数据NAS设备hack
通过该文学习一下常见硬件web漏洞.重点关注一下几个方面: 1.登录验证代码: 2.文件上传代码: 3.system/exec/popen等是否存在注入可能: 4.调用二进制文件: 5.未登陆可以访问 ...
- 洛谷P2520向量
题目传送门 看到数据范围其实就可以确定这是一道结论题. 首先分析,给定你的向量的两个坐标a,b有八种组合方式可以用,但实际上整理一下可以得出实际上只有五种,x/y ±2a,x/y ±2b,x+a,y+ ...