当前位置:网站首页>Poj2315 football games
Poj2315 football games
2022-07-06 01:25:00 【zjsru_ Beginner】
Problem description :
analysis : The main idea of the topic is that the two players take turns from N Pick out no more than M Shot , The radius of each sphere is R, Off goal S. You can only kick L Within the distance . The one who scores the last goal wins , Ask who has a winning strategy ? We found that after processing the data , The title is equivalent to giving n Rubble , The maximum number of stones in each pile is k A stone , At most m A game problem of stone pile operation , First of all, we stack each pile of stones right k+1 Modular simplification , The practice of taking stones from a pile of stones is to stack all stones sg Value for xor Operation result sg value ,xor Also known as semi addition , Only add without carry , For selection m The game of piling stones is ours xor It's about m+1 Half addition operation under base , So we calculate this in bits sg value , simulation m+1 The answer can be obtained by half addition operation under base .
Input :
The input consists of several cases , Each case contains two lines .
For each test case , The first line contains 4 It's an integer N、M、L and R(1 <= M <= N <= 30, 0 < L < 100000000, 0 < R < 10000), Separate... With a space .N It's the number of football ,M It is the maximum number of football a player can shoot in a round ,L Is the maximum distance a player can shoot ,R Is the radius of football .
The next line contains N A digital ,S(1), S(2), ..., S(N) (0 < S(i) < 100000000), They describe the distance between football and goal .
Output :
For each case , The output contains a line describing the name of the winner .
Sample input :

Sample output :

Program code :
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int N=30;
const double PI=acos(-1.0);
int n,m,l,r,a[N],sg[N];
int dis(int s) // See if you can score
{
return (int)(s/(2*PI*r))+1;
}
bool solve(){ // Game function
memset(sg,0,sizeof(sg));
int k=dis(l);
for(int i=0;i<n;i++)
for(int j=0,g=dis(a[i])%k;sg[j]+=g&1,g;j++,g>>=1);
for(int i=0;i<30;i++)
if(sg[i]%(m+1))
return 1;
return 0;
}
int main(){
while(~scanf("%d%d%d%d",&n,&m,&l,&r)){
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
puts(solve()?"Alice":"Bob");
}
return 0;
}yjg
边栏推荐
- Docker compose configures MySQL and realizes remote connection
- [solved] how to generate a beautiful static document description page
- Opinions on softmax function
- Redis' cache penetration, cache breakdown, cache avalanche
- How to get all sequences in Oracle database- How can I get all sequences in an Oracle database?
- leetcode刷题_反转字符串中的元音字母
- [技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览
- Leetcode1961. 检查字符串是否为数组前缀
- In the era of industrial Internet, we will achieve enough development by relying on large industrial categories
- Convert binary search tree into cumulative tree (reverse middle order traversal)
猜你喜欢

The growth path of test / development programmers, the problem of thinking about the overall situation

MATLB|实时机会约束决策及其在电力系统中的应用

Kotlin basics 1

Loop structure of program (for loop)

About error 2003 (HY000): can't connect to MySQL server on 'localhost' (10061)

Exciting, 2022 open atom global open source summit registration is hot

leetcode刷题_反转字符串中的元音字母

BiShe - College Student Association Management System Based on SSM

Mathematical modeling learning from scratch (2): Tools

晶振是如何起振的?
随机推荐
[day 30] given an integer n, find the sum of its factors
FFT 学习笔记(自认为详细)
Mathematical modeling learning from scratch (2): Tools
Unity VR solves the problem that the handle ray keeps flashing after touching the button of the UI
Basic process and testing idea of interface automation
Three methods of script about login and cookies
Leetcode daily question solution: 1189 Maximum number of "balloons"
Loop structure of program (for loop)
In the era of industrial Internet, we will achieve enough development by relying on large industrial categories
Condition and AQS principle
Leetcode 208. Implement trie (prefix tree)
Gartner released the prediction of eight major network security trends from 2022 to 2023. Zero trust is the starting point and regulations cover a wider range
Overview of Zhuhai purification laboratory construction details
[technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry
基于DVWA的文件上传漏洞测试
Mlsys 2020 | fedprox: Federation optimization of heterogeneous networks
Tcpdump: monitor network traffic
Ubantu check cudnn and CUDA versions
关于softmax函数的见解
Leetcode 208. 实现 Trie (前缀树)