当前位置:网站首页>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;
}
边栏推荐
- Tips for using dm8huge table
- pd. to_ numeric
- [disassembly] a visual air fryer. By the way, analyze the internal circuit
- 在字节做测试5年,7月无情被辞,想给划水的兄弟提个醒
- DM8 backup set deletion
- Mapping between QoE and KQI
- Esp32 (based on Arduino) connects the mqtt server of emqx to upload information and command control
- Network security - Security Service Engineer - detailed summary of skill manual (it is recommended to learn and collect)
- math_ Derivative function derivation of limit & differential & derivative & derivative / logarithmic function (derivative definition limit method) / derivative formula derivation of exponential functi
- C language circular statement
猜你喜欢
![[adjustable delay network] development of FPGA based adjustable delay network system Verilog](/img/82/7ff7f99f5164f91fab7713978cf720.png)
[adjustable delay network] development of FPGA based adjustable delay network system Verilog

BUAA magpie nesting

Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did
![[meisai] meisai thesis reference template](/img/14/b39e1db0b5b35702508068e028ee5a.jpg)
[meisai] meisai thesis reference template
![[analysis of variance] single factor analysis and multi factor analysis](/img/92/5337d0ef6e487d1af2f56cb3a3268a.jpg)
[analysis of variance] single factor analysis and multi factor analysis

Ks008 SSM based press release system

After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling

Benefits of automated testing
![[Key shake elimination] development of key shake elimination module based on FPGA](/img/47/c3833c077ad89d4906e425ced945bb.png)
[Key shake elimination] development of key shake elimination module based on FPGA

Database, relational database and NoSQL non relational database
随机推荐
[meisai] meisai thesis reference template
Yyds dry goods inventory hcie security Day11: preliminary study of firewall dual machine hot standby and vgmp concepts
Blue Bridge Cup - day of week
Ybtoj coloring plan [tree chain dissection, segment tree, tarjan]
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
Microkernel structure understanding
[adjustable delay network] development of FPGA based adjustable delay network system Verilog
Take you to wechat applet development in 3 minutes
Yyds dry goods inventory web components series (VII) -- life cycle of custom components
Blue Bridge Cup - Castle formula
Use js to complete an LRU cache
How to modify field constraints (type, default, null, etc.) in a table
Align items and align content in flex layout
80% of the diseases are caused by bad living habits. There are eight common bad habits, which are both physical and mental
Exchange bottles (graph theory + thinking)
Serial port-rs232-rs485-ttl
如何修改表中的字段约束条件(类型,default, null等)
[analysis of variance] single factor analysis and multi factor analysis
/usr/bin/gzip: 1: ELF: not found/usr/bin/gzip: 3: : not found/usr/bin/gzip: 4: Syntax error:
Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did