当前位置:网站首页>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
边栏推荐
- Netease smart enterprises enter the market against the trend, and there is a new possibility for game industrialization
- JMeter BeanShell的基本用法 一下语法只能在beanshell中使用
- Live video source code, realize local storage of search history
- Vulhub vulnerability recurrence 74_ Wordpress
- 基於DVWA的文件上傳漏洞測試
- Unity | 实现面部驱动的两种方式
- Daily practice - February 13, 2022
- Huawei converged VLAN principle and configuration
- DOM introduction
- [technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry
猜你喜欢
About error 2003 (HY000): can't connect to MySQL server on 'localhost' (10061)
JVM_ 15_ Concepts related to garbage collection
3D模型格式汇总
Finding the nearest common ancestor of binary tree by recursion
Unity | 实现面部驱动的两种方式
[pat (basic level) practice] - [simple mathematics] 1062 simplest fraction
MySQL learning notes 2
Ordinary people end up in Global trade, and a new round of structural opportunities emerge
3D vision - 4 Getting started with gesture recognition - using mediapipe includes single frame and real time video
Some features of ECMAScript
随机推荐
ThreeDPoseTracker项目解析
Vulhub vulnerability recurrence 75_ XStream
PHP error what is an error?
Is chaozhaojin safe? Will it lose its principal
In the era of industrial Internet, we will achieve enough development by relying on large industrial categories
Spir - V premier aperçu
Distributed base theory
朝招金安全吗 会不会亏损本金
How to see the K-line chart of gold price trend?
Hcip---ipv6 experiment
internship:项目代码所涉及陌生注解及其作用
CocoaPods could not find compatible versions for pod 'Firebase/CoreOnly'
Use of crawler manual 02 requests
3D视觉——4.手势识别(Gesture Recognition)入门——使用MediaPipe含单帧(Singel Frame)和实时视频(Real-Time Video)
Cglib dynamic agent -- example / principle
The growth path of test / development programmers, the problem of thinking about the overall situation
3D model format summary
ORA-00030
[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览
Superfluid_ HQ hacked analysis