当前位置:网站首页>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;
}
边栏推荐
- [Key shake elimination] development of key shake elimination module based on FPGA
- asp. Core is compatible with both JWT authentication and cookies authentication
- Flask learning and project practice 9: WTF form verification
- Codeforces Global Round 19
- 简易博客系统
- Data analysis Seaborn visualization (for personal use)
- Introduction to data types in MySQL
- Take you to wechat applet development in 3 minutes
- MySql数据库root账户无法远程登陆解决办法
- Viewing and verifying backup sets using dmrman
猜你喜欢
JVM的手术刀式剖析——一文带你窥探JVM的秘密
DM8 backup set deletion
mysql关于自增长增长问题
TCP/IP协议里面的网关地址和ip地址有什么区别?
Yyds dry goods inventory hcie security Day11: preliminary study of firewall dual machine hot standby and vgmp concepts
2.13 weekly report
UDP reliable transport protocol (quic)
Ks003 mall system based on JSP and Servlet
KS003基于JSP和Servlet实现的商城系统
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
随机推荐
Database, relational database and NoSQL non relational database
Pandora IOT development board learning (HAL Library) - Experiment 9 PWM output experiment (learning notes)
Microkernel structure understanding
有条件地 [JsonIgnore]
MySql数据库root账户无法远程登陆解决办法
C (XXIX) C listbox CheckedListBox Imagelist
Thread sleep, thread sleep application scenarios
Multi project programming minimalist use case
UDP reliable transport protocol (quic)
[Qt5] QT QWidget immediately appears and disappears
Custom event of C (31)
Determine which week of the month the day is
JVM的手术刀式剖析——一文带你窥探JVM的秘密
判断当天是当月的第几周
Oracle ORA error message
SSTI template injection explanation and real problem practice
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
[001] [stm32] how to download STM32 original factory data
C mouse event and keyboard event of C (XXVIII)
【可调延时网络】基于FPGA的可调延时网络系统verilog开发