当前位置:网站首页>2022暑期杭电多校第一场1012Alice and Bob(博弈论)
2022暑期杭电多校第一场1012Alice and Bob(博弈论)
2022-07-24 18:36:00 【愚者的黄昏】
问题描述
爱丽丝和鲍勃喜欢玩游戏。
有m写在黑板上的数字,所有这些都是介于0和n.
游戏规则如下:
如果黑板上还有数字,并且没有带值的数字0在黑板上,爱丽丝可以将黑板上剩余的数字分成两组。
Bob 选择其中一组并擦除该集中的所有数字。然后将所有剩余的数字减去一。
在任何时候,如果有一个值为0在黑板上,爱丽丝获胜;否则,如果黑板上的所有数字都被擦除,则鲍勃获胜。
请确定如果爱丽丝和鲍勃都以最佳方式玩游戏,谁将赢得游戏。
每个测试用例的第一行包含单个整数n(1≤∑n≤106).
每个测试用例的第二行包含n+1整数一个0,一个1,一个2。。。一个n(0≤一个我≤106,∑一个我=m)— 有一个我带值的数字我在黑板上。
示例输入
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;
const int mod=1e9+7;
const int N=1e6+5,M=15;
typedef long long LL;
typedef pair<double,double> PDD;
LL a[N];
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0 ; i<=n ; i++ ) cin>>a[i];
for(int i=n;i>0;i--){
a[i-1]+=a[i]/2;
}
if(a[0]) puts("Alice");
else puts("Bob");
}
return 0;
}边栏推荐
- Template inheritance and import
- EasyUI framework dialog repeated loading problem
- Type-C边充边听PD协议芯片
- 初识Pytorch和Pytorch环境配置
- Rookie colleagues cost me 2K. Did you recite the secret of salary increase? (collect it quickly!)
- 理解corners_align,两种看待像素的视角
- 线程的生命周周期和基本方法
- 【微信小程序开发】自定义tabBar案例(定制消息99+小红心)
- epoch,batch_ size
- Getting started with MySQL database
猜你喜欢

理解动态计算图,requires_grad、zero_grad

Typora 它依然是我心中的YYDS 最优美也是颜值最高的文档编辑神器 相信你永远不会抛弃它

Missing value processing

EasyUI framework dialog repeated loading problem

今日睡眠质量记录79分

Maximum sum and promotion of continuous subarrays (2)
![[wechat applet development] custom tabbar case (custom message 99 + little hearts)](/img/49/354ecb448e91d9e15aaec4922a62e1.png)
[wechat applet development] custom tabbar case (custom message 99 + little hearts)

Vsftpd2.3.4-端口渗透 6200 irc_3281_backdoor

L4L7负载均衡

32-bit stack overflow advanced
随机推荐
Attack and defense world novice zone PWN
1. Typeof view variable type?
根证书的有效期与服务器SSL证书一样长吗?
CF Lomsat gelral(启发式合并)
字符串的遍历及拼接
mysql 配置文件
怎么解决idea中yaml无法识别或者飘红?
Space three point circle code
Pytoch's Journey 2: gradient descent
Go小白实现一个简易的go mock server
Four ways of simple interest mode
使用der格式公钥生成publicKey报错
Highcharts chart and report display, export data
Valentine's Day gift ----- use her photos and our chat records to generate word clouds~
投资的新阶段
Variable and immutable data types
Generate publickey with der format public key and report an error
Pytorch的旅程一:线性模型
Maximum sum and promotion of continuous subarrays (2)
The difference between KIB and MIB and KB and MB