当前位置:网站首页>Codeforces Round #770 (Div. 2) B. Fortune Telling
Codeforces Round #770 (Div. 2) B. Fortune Telling
2022-07-06 03:59:00 【Invincible young whirlwind】
Title Description
Alice and Bob Fortune-telling , The process is as follows :
Given array a contain n Number ,Alice The starting number of is x,Bob The starting number of is x+3, Two people on the array a Each number in performs one of the following operations , Give a number y, Ask who gets the last sum y identical , The two operations are as follows :
- Put the current number d Turn into d+ai
- Put the current number d Turn into d Exclusive or ai
The two operations are addition and XOR , XOR is a bit operation , The algorithm is the same 0 different 1, namely
0 xor 0 = 0
0 xor 1 = 1
1 xor 0 = 1
1 xor 1 = 0
The operation of XOR is consistent with the operation of addition , The title says that there must be someone who can get y, So for each number in the array , Either XOR or add , Judge who gets the last number Last
and y The same can be .
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 100010;
int a[N];
void solve()
{
int n;
long long x, y, cur;
cin >> n >> x >> y;
cur = x;
for(int i = 0; i < n; i ++)
{
int t; cin >> t;
cur += t;
}
if(cur % 2 == y % 2) puts("Alice");
else puts("Bob");
}
int main()
{
int t; cin >> t;
while(t --) solve();
return 0;
}
边栏推荐
- 《2022年中国银行业RPA供应商实力矩阵分析》研究报告正式启动
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- [American competition] mathematical terms
- JVM的手术刀式剖析——一文带你窥探JVM的秘密
- 简易博客系统
- Chinese brand hybrid technology: there is no best technical route, only better products
- Python book learning notes - Chapter 09 section 01 create and use classes
- In Net 6 CS more concise method
- math_极限&微分&导数&微商/对数函数的导函数推导(导数定义极限法)/指数函数求导公式推导(反函数求导法则/对数求导法)
- Web components series (VII) -- life cycle of custom components
猜你喜欢
【PSO】基于PSO粒子群优化的物料点货物运输成本最低值计算matlab仿真,包括运输费用、代理人转换费用、运输方式转化费用和时间惩罚费用
How does technology have the ability to solve problems perfectly
User experience index system
RT thread -- FTP of LwIP (2)
Cf464e the classic problem [shortest path, chairman tree]
[Key shake elimination] development of key shake elimination module based on FPGA
Yyds dry goods inventory web components series (VII) -- life cycle of custom components
Multi project programming minimalist use case
Blue Bridge Cup - Castle formula
Factors affecting user perception
随机推荐
在 .NET 6 中使用 Startup.cs 更简洁的方法
51nod 1130 n factorial length V2 (Stirling approximation)
[prediction model] difference method model
Microkernel structure understanding
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
WPF effect Article 191 box selection listbox
C#(二十八)之C#鼠标事件、键盘事件
Ks008 SSM based press release system
[Qt5] QT QWidget immediately appears and disappears
Stack and queue
[001] [stm32] how to download STM32 original factory data
The Research Report "2022 RPA supplier strength matrix analysis of China's banking industry" was officially launched
How to modify field constraints (type, default, null, etc.) in a table
pd. to_ numeric
TCP/IP协议里面的网关地址和ip地址有什么区别?
Yyds dry goods inventory hcie security Day11: preliminary study of firewall dual machine hot standby and vgmp concepts
自动化测试怎么规范部署?
Basic knowledge of binary tree, BFC, DFS
【FPGA教程案例12】基于vivado核的复数乘法器设计与实现
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储