POJ Football Game 【NIMK博弈 && Bash 博弈】
Football Game
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 451 | Accepted: 178 |
Description
Input
For each test case, the first line contains 4 integers N, M, L and R (1 <= M <= N <= 30, 0 < L < 100000000, 0 < R < 10000), separated by a single space. N is the number of the footballs, M is the maximum number of footballs one player can shot in one turn, L is the maximum distance that a player can shoot, and R is the radius of footballs.
The next line contains N numbers, S(1), S(2), ..., S(N) (0 < S(i) < 100000000), which describe the distance between footballs and the goal.
Output
Sample Input
2 1 30 1
8 14
2 1 30 1
8 12
2 1 30 1
8 10
2 1 30 1
40 200
Sample Output
Alice
Bob
Bob
Bob
Source
//#include <bits/stdc++.h>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define inc(i, j, k) for(int i = j; i <= k; i++)
#define rep(i, j, k) for(int i = j; i < k; i++)
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)
#define INF 0x3f3f3f3f
#define LL long long
#define MEM(i, j) memset(i, j, sizeof(i));
#define gcd(i, j) __gcd(i, j)
using namespace std;
const int MAXN = 1e5+;
const double PI = acos(-1.0);
int SG[MAXN];
int XOR[MAXN];
int xxx;
int num;
int maxn; bool solve(int N, int M)
{
MEM(XOR, );
maxn = -;
inc(i, , N){
xxx = SG[i];
num = ;
while(xxx){
XOR[num]+=xxx&;
num++;
xxx>>=;
}
maxn = max(maxn, num);
}
rep(i, , maxn){
if(XOR[i]%(M+)) return true;
}
return false;
}
int N, M, L, R;
int s; int main()
{
while(~scanf("%d %d %d %d", &N, &M, &L, &R)){
s = L/(*PI*R); //最远的距离
inc(i, , N){
scanf("%d", &SG[i]);
SG[i] = SG[i]/(*PI*R) + ; //距离球门的距离
SG[i]%=s+; // Bash博弈
}
if(solve(N, M)) puts("Alice"); //NIMK 博弈
else puts("Bob");
}
return ;
}
POJ Football Game 【NIMK博弈 && Bash 博弈】的更多相关文章
- poj 1704 Georgia and Bob(阶梯博弈)
Georgia and Bob Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9363 Accepted: 3055 D ...
- HDU 2188 基础bash博弈
基础的bash博弈,两人捐钱,每次不超过m,谁先捐到n谁胜. 对于一个初始值n,如果其不为(m+1)的倍数,那么先手把余数拿掉,后继游戏中不管如何,后手操作后必定会有数余下,那么先手必胜,反之后手必胜 ...
- HDU 1525 类Bash博弈
给两数a,b,大的数b = b - a*k,a*k为不大于b的数,重复过程,直到一个数为0时,此时当前操作人胜. 可以发现如果每次b=b%a,那么GCD的步数决定了先手后手谁胜,而每次GCD的一步过程 ...
- HDU 2897 邂逅明下 ( bash 博弈变形
HDU 2897 邂逅明下 ( bash 博弈变形 题目大意 有三个数字n,p,q,表示一堆硬币一共有n枚,从这个硬币堆里取硬币,一次最少取p枚,最多q枚,如果剩下少于p枚就要一次取完.两人轮流取,直 ...
- bash 博弈
转载并修改自: http://www.cnblogs.com/wulangzhou/archive/2013/03/14/2959660.html 简单的取拿游戏一堆石子(或者其它的什么东西),下面是 ...
- POJ1704 Georgia and Bob 博弈论 尼姆博弈 阶梯博弈
http://poj.org/problem?id=1704 我并不知道阶梯博弈是什么玩意儿,但是这道题的所有题解博客都写了这个标签,所以我也写了,百度了一下,大概是一种和这道题类似的能转换为尼姆博弈 ...
- luogu P2252 威佐夫博弈 模板 博弈
LINK:威佐夫博弈 四大博弈 我都没有好好整理 不过大致可以了解一下. 在这个博弈中 存在一些局面 先手遇到必胜. 不过由于后手必胜的局面更具规律性这里研究先手遇到的局面后手必胜的情况. 这些局面分 ...
- poj 2484 A Funny Game(博弈)
A Funny Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4639 Accepted: 2855 Desc ...
- 51Nod 1067 Bash博弈V2
这道题告诉我,一定要去尝试,去推算,不要动不动就找度娘要答案.(惭愧惭愧) 既然是博弈问题,按理我们应该找出规律,怎么找呢,推,把前几项写出来找规律,动手很重要. 上题: 1067 Bash游戏 V2 ...
随机推荐
- JAVA编写简单的日历,输入日期即可查看日历
利用LocalDate输入年月日找出当月日历 直接上代码 import java.time.LocalDate; import java.util.Scanner; public class Cale ...
- 撩课-Web大前端每天5道面试题-Day23
1.为什么用Nodejs,它有哪些优缺点? 优点: 事件驱动,通过闭包很容易实现客户端的生命活期. 不用担心多线程,锁,并行计算的问题 V8引擎速度非常快 对于游戏来说,写一遍游戏逻辑代码,前端后端通 ...
- hdu 1043 八数码问题
Eight Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Subm ...
- J2EE企业级应用架构发展
一. 准备工作 1. 本文参考 J2EE企业级应用架构 二. 架构发展 1. 原始版 用户+服务器[单台虚拟机]+数据库[mysql或者oracle],用户访问量比较少. 特点:单节点[只有一台机器] ...
- 浅谈脚本化css(二)
查询计算样式 window上面有一个方法叫做getComputedStyle可以来获取元素的计算样式,也就是css样式. window.getComputedStyle(ele. null); J ...
- BZOJ3672: [Noi2014]购票(dp 斜率优化 点分治 二分 凸包)
题意 题目链接 Sol 介绍一种神奇的点分治的做法 啥?这都有根树了怎么点分治?? 嘿嘿,这道题的点分治不同于一般的点分治.正常的点分治思路大概是先统计过重心的,再递归下去 实际上一般的点分治与统计顺 ...
- display none隐藏后如果表单有数值,那么他的数值还存在!
以前以为display:none后他的值就不存在了, display:none隐藏后如果表单有数值,那么他的数值还存在.(项目出了问题!!) <!DOCTYPE html PUBLIC &quo ...
- 使用tour_editor.html设置视角和添加热点
控制初始视角 双击打开vtour文件夹中的tour_editor.html.(请先运行测试服务器,然后在浏览器地址栏中加上tour_editor.html,例如 http://localhost:52 ...
- 清除浮动以及:after元素
http://www.iyunlu.com/demo/enclosing-float-and-clearing-float/index.html 以上这篇示意图把清除浮动的几种方法讲的非常清楚了,其中 ...
- Kriging插值计算
参考论文: http://people.ku.edu/~gbohling/cpe940 # -*- coding: utf-8 -*- # ----------------------- ...