当前位置:网站首页>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
边栏推荐
- Dede collection plug-in free collection release push plug-in
- Gartner发布2022-2023年八大网络安全趋势预测,零信任是起点,法规覆盖更广
- 【SSRF-01】服务器端请求伪造漏洞原理及利用实例
- [Yu Yue education] Liaoning Vocational College of Architecture Web server application development reference
- After 95, the CV engineer posted the payroll and made up this. It's really fragrant
- 什么是弱引用?es6中有哪些弱引用数据类型?js中的弱引用是什么?
- A picture to understand! Why did the school teach you coding but still not
- How does Huawei enable debug and how to make an image port
- Leetcode 208. 实现 Trie (前缀树)
- 有谁知道 达梦数据库表的列的数据类型 精度怎么修改呀
猜你喜欢
Electrical data | IEEE118 (including wind and solar energy)
Unity | 实现面部驱动的两种方式
Une image! Pourquoi l'école t'a - t - elle appris à coder, mais pourquoi pas...
基于DVWA的文件上传漏洞测试
Dede collection plug-in free collection release push plug-in
ADS-NPU芯片架构设计的五大挑战
Recommended areas - ways to explore users' future interests
yii中console方法调用,yii console定时任务
Huawei Hrbrid interface and VLAN division based on IP
General operation method of spot Silver
随机推荐
Folio.ink 免费、快速、易用的图片分享工具
普通人下场全球贸易,新一轮结构性机会浮出水面
VMware Tools安装报错:无法自动安装VSock驱动程序
Interview must brush algorithm top101 backtracking article top34
How to get the PHP version- How to get the PHP Version?
Overview of Zhuhai purification laboratory construction details
Some features of ECMAScript
Remember that a version of @nestjs/typeorm^8.1.4 cannot be obtained Env option problem
[the most complete in the whole network] |mysql explain full interpretation
Unity | two ways to realize facial drive
Une image! Pourquoi l'école t'a - t - elle appris à coder, mais pourquoi pas...
MYSQL---查询成绩为前5名的学生
Paging of a scratch (page turning processing)
MUX VLAN configuration
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
Kotlin basics 1
A glimpse of spir-v
A picture to understand! Why did the school teach you coding but still not
Netease smart enterprises enter the market against the trend, and there is a new possibility for game industrialization
有谁知道 达梦数据库表的列的数据类型 精度怎么修改呀