当前位置:网站首页>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;
}
边栏推荐
- BUAA magpie nesting
- A brief introduction to symbols and link libraries in C language
- LTE CSFB test analysis
- User perceived monitoring experience
- Ks003 mall system based on JSP and Servlet
- Database, relational database and NoSQL non relational database
- C#(二十九)之C#listBox checkedlistbox imagelist
- BUAA calculator (expression calculation - expression tree implementation)
- Factors affecting user perception
- Alibaba testers use UI automated testing to achieve element positioning
猜你喜欢
math_ Derivative function derivation of limit & differential & derivative & derivative / logarithmic function (derivative definition limit method) / derivative formula derivation of exponential functi
Multi project programming minimalist use case
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
JS Vanke banner rotation chart JS special effect
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
Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did
MySQL about self growth
登录mysql输入密码时报错,ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO/YES
[practice] mathematics in lottery
阿里测试师用UI自动化测试实现元素定位
随机推荐
UDP reliable transport protocol (quic)
[meisai] meisai thesis reference template
KS003基于JSP和Servlet实现的商城系统
【FPGA教程案例11】基于vivado核的除法器设计与实现
An article will give you a comprehensive understanding of the internal and external components of "computer"
C#(三十)之C#comboBox ListView treeView
Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
MySQL reads missing data from a table in a continuous period of time
Alibaba testers use UI automated testing to achieve element positioning
判断当天是当月的第几周
Oracle ORA error message
Crawler of explanation and application of agency theory
Security xxE vulnerability recurrence (XXe Lab)
Schnuka: 3D vision detection application industry machine vision 3D detection
[001] [stm32] how to download STM32 original factory data
Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did
How to standardize the deployment of automated testing?
/usr/bin/gzip: 1: ELF: not found/usr/bin/gzip: 3: : not found/usr/bin/gzip: 4: Syntax error:
3分钟带你了解微信小程序开发
On Data Mining