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 ...
随机推荐
- python并发模块之concurrent.futures(一)
Python3.2开始,标准库为我们提供了concurrent.futures模块,它提供了ThreadPoolExecutor和ProcessPoolExecutor两个类,实现了对threadin ...
- 【bzoj2006】NOI2010超级钢琴
补了下前置技能…… 题意就是求一段区间的权值和前k大的子序列的和. 把段扔进优先队列 每次拿出来之后按照所选择的j进行分裂 #include<bits/stdc++.h> #define ...
- Freemarker的页面和JS遍历后台传入的Map
后端传到前端的Map Freemarker页面遍历Map: JS遍历Map:
- LeetCode239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...
- ofbiz 之minilang解析
编写一个simple method 首先我们需要对输入参数进行验证 ,判断参数是否完整. 1. 验证 1.1. Login-required :这是一个simple-method的属性,对是否需要登陆 ...
- K8S的APISERVER,应用了HTTPS之后,命令行如何访问?
用命令行总是很麻烦,因为要自定义一些证书的位置....... curl https://1.2.3.1:443/api/v1/nodes \ --cacert /etc/kubernetes/pki/ ...
- lr计算程序执行消耗时间的比较:
去除程序执行的两种方式: 1.通过一个事务:在需要消除的代码段,使用lr_wasted_time(wasteTime); querySubmit() { char newStr4[10000]=&qu ...
- Delphi 设计模式:《HeadFirst设计模式》Delphi7代码---工厂模式之简单工厂
简单工厂:工厂依据传进的参数创建相应的产品. http://www.cnblogs.com/DelphiDesignPatterns/archive/2009/07/24/1530536.html { ...
- 二分查找(BinarySearch)
http://blog.csdn.net/magicharvey/article/details/10282801 简单描述 二分查找,又名折半查找,是一种在有序序列中查找特定元素的搜索算法.搜素过程 ...
- Js文件中调用其它Js函数的方法
在项目开发过程中,也许你会遇这样的情况.在某一Js文件中需要完成某一功能,但这一功能的大部分代码在另外一个Js文件中已经完成了,自己只需要调用这个方法再加上几句代码就可以实现所需的功能.我们知道,在h ...