当前位置:网站首页>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;
}
边栏推荐
- Serial port-rs232-rs485-ttl
- Tips for using dm8huge table
- 自动化测试的好处
- 【leetcode】22. bracket-generating
- C (XXIX) C listbox CheckedListBox Imagelist
- Data analysis Seaborn visualization (for personal use)
- 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
- Use js to complete an LRU cache
- [001] [stm32] how to download STM32 original factory data
- Multi project programming minimalist use case
猜你喜欢
STC8H开发(十二): I2C驱动AT24C08,AT24C32系列EEPROM存储
Ethernet port &arm & MOS &push-pull open drain &up and down &high and low sides &time domain and frequency domain Fourier
After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
[introduction to Django] 11 web page associated MySQL single field table (add, modify, delete)
C#(二十九)之C#listBox checkedlistbox imagelist
[FPGA tutorial case 11] design and implementation of divider based on vivado core
【按键消抖】基于FPGA的按键消抖模块开发
Proof of Stirling formula
MySQL about self growth
Record the pit of NETCORE's memory surge
随机推荐
Introduction to data types in MySQL
Containerization Foundation
Maxay paper latex template description
Thread sleep, thread sleep application scenarios
Custom event of C (31)
User datagram protocol UDP
Pytoch foundation - (1) initialization of tensors
Viewing and verifying backup sets using dmrman
[Qt5] QT QWidget immediately appears and disappears
C#(二十九)之C#listBox checkedlistbox imagelist
Serial port-rs232-rs485-ttl
SSTI template injection explanation and real problem practice
Chinese brand hybrid technology: there is no best technical route, only better products
【leetcode】22. bracket-generating
ESP32_ FreeRTOS_ Arduino_ 1_ Create task
C#(二十八)之C#鼠标事件、键盘事件
[American competition] mathematical terms
Use js to complete an LRU cache
3分钟带你了解微信小程序开发
Hashcode and equals