当前位置:网站首页>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;
}
边栏推荐
- [Qt5] QT QWidget immediately appears and disappears
- Serial port-rs232-rs485-ttl
- 51nod 1130 n factorial length V2 (Stirling approximation)
- C#(三十一)之自定义事件
- Maxay paper latex template description
- Do you know cookies, sessions, tokens?
- Failure causes and optimization methods of LTE CSFB
- [meisai] meisai thesis reference template
- Align items and align content in flex layout
- Esp32 (based on Arduino) connects the mqtt server of emqx to upload information and command control
猜你喜欢

KS003基于JSP和Servlet实现的商城系统

MySQL master-slave replication

BUAA calculator (expression calculation - expression tree implementation)

阿里测试师用UI自动化测试实现元素定位

Viewing and verifying backup sets using dmrman

UDP reliable transport protocol (quic)

记一次excel XXE漏洞

Detailed explanation of serialization and deserialization

【按鍵消抖】基於FPGA的按鍵消抖模塊開發

BUAA magpie nesting
随机推荐
[PSO] Based on PSO particle swarm optimization, matlab simulation of the calculation of the lowest transportation cost of goods at material points, including transportation costs, agent conversion cos
Database, relational database and NoSQL non relational database
math_极限&微分&导数&微商/对数函数的导函数推导(导数定义极限法)/指数函数求导公式推导(反函数求导法则/对数求导法)
Ipv4中的A 、B、C类网络及子网掩码
【leetcode】22. bracket-generating
简易博客系统
Conditionally [jsonignore]
TCP/IP协议里面的网关地址和ip地址有什么区别?
User perceived monitoring experience
Blue style mall website footer code
Simple blog system
【按鍵消抖】基於FPGA的按鍵消抖模塊開發
Codeforces Global Round 19
How does technology have the ability to solve problems perfectly
Ybtoj coloring plan [tree chain dissection, segment tree, tarjan]
RT thread -- FTP of LwIP (2)
Hashcode and equals
Mapping between QoE and KQI
Blue Bridge Cup - day of week
C#(三十)之C#comboBox ListView treeView