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内核中内存cache的实现【转】
Linux内核中内存cache的实现 转自:http://blog.chinaunix.net/uid-127037-id-2919545.html 本文档的Copyleft归yfydz所有,使用 ...
- C语言面试题总结(一)
以前的记录都在电子笔记里,倒不如拿出来,有错的地方和大家交流. 1.指针操作: 如下例,设a内存地址为OX00 int a =10; int *p = &a; *a 编译错误 a表示10 *p ...
- PIL处理图片信息
最近遇到了图片处理的一些问题,python提供了一些库可以很方便地帮助我们解决这些问题,在这里把我这几天的学习总结一下. 一.提取图片的RGB值 1.非代码:如果只是为了提取某张图片或者某个像素点的R ...
- 字符串截取,SubString
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAk8AAACYCAIAAAByAZqHAAAYgklEQVR4nO2dL28ku5qHTS4ctuTSQf ...
- virtualenv--创建虚拟环境
一.virtualenv 优点 1.使用不同应用开发环境独立 2.环境升级不影响其他应用,也不会影响全局的python 环境二.安装 pip install virtualenv 三.使用virtua ...
- Longest Valid Parentheses——仍然需要认真看看(动态规划)
Given a string containing just the characters '(' and ')', find the length of the longest valid (wel ...
- php 公历农历互相转换
废话不多,直接上代码 <?php class Lunar { /** * Created by 闻海南. * User: timeless * Date: 2018-5-29 * Time: 上 ...
- selenium c# 的注意事项
http://chromedriver.storage.googleapis.com/index.html chromedriver的下载地址http://selenium-release.stora ...
- Qt发布可能遇到的问题
1.首先要搞清楚动态链接库还是静态链接 本文只涉及动态链接库,就是编译出来的exe文件加上Qt 的必要dll文件. 一般跟别人一样的操作,直接双击 XX.exe,提示缺少什么dll,就去Qt的安装目录 ...
- Kvm虚拟化安装与虚拟机创建
1. 验证CPU是否支持KVM:如果结果中有vmx(Intel)或svm(AMD)字样,就说明CPU的支持的. egrep '(vmx|svm)' /proc/cpuinfo 2. 关闭SELinux ...