当前位置:网站首页>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
边栏推荐
- Leetcode 208. Implement trie (prefix tree)
- FFT 学习笔记(自认为详细)
- [technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry
- Development trend of Ali Taobao fine sorting model
- Overview of Zhuhai purification laboratory construction details
- Live broadcast system code, custom soft keyboard style: three kinds of switching: letters, numbers and punctuation
- Threedposetracker project resolution
- A picture to understand! Why did the school teach you coding but still not
- 【SSRF-01】服务器端请求伪造漏洞原理及利用实例
- 3D model format summary
猜你喜欢

ORA-00030

037 PHP login, registration, message, personal Center Design
![[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览](/img/94/05b2ff62a8a11340cc94c69645db73.png)
[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览

How to see the K-line chart of gold price trend?

伦敦银走势中的假突破

2020.2.13

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

Hcip---ipv6 experiment

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

Docker compose配置MySQL并实现远程连接
随机推荐
[Yu Yue education] Liaoning Vocational College of Architecture Web server application development reference
Development trend of Ali Taobao fine sorting model
黄金价格走势k线图如何看?
Basic process and testing idea of interface automation
[the most complete in the whole network] |mysql explain full interpretation
Recommended areas - ways to explore users' future interests
SCM Chinese data distribution
[day 30] given an integer n, find the sum of its factors
yii中console方法调用,yii console定时任务
A Cooperative Approach to Particle Swarm Optimization
Mobilenet series (5): use pytorch to build mobilenetv3 and learn and train based on migration
XSS learning XSS lab problem solution
servlet(1)
FFT 学习笔记(自认为详细)
Overview of Zhuhai purification laboratory construction details
How to get all sequences in Oracle database- How can I get all sequences in an Oracle database?
Recursive method converts ordered array into binary search tree
Leetcode 剑指 Offer 59 - II. 队列的最大值
BiShe - College Student Association Management System Based on SSM
In the era of industrial Internet, we will achieve enough development by relying on large industrial categories