当前位置:网站首页>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;
}
边栏推荐
- Flask learning and project practice 9: WTF form verification
- MySql数据库root账户无法远程登陆解决办法
- Serial port-rs232-rs485-ttl
- /usr/bin/gzip: 1: ELF: not found/usr/bin/gzip: 3: : not found/usr/bin/gzip: 4: Syntax error:
- Redis (replicate dictionary server) cache
- Prime Protocol宣布在Moonbeam上的跨链互连应用程序
- Recommended papers on remote sensing image super-resolution
- C (thirty) C combobox listview TreeView
- Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
- Viewing and verifying backup sets using dmrman
猜你喜欢

Ipv4中的A 、B、C类网络及子网掩码

TCP/IP协议里面的网关地址和ip地址有什么区别?

MySQL master-slave replication

简易博客系统

How to modify field constraints (type, default, null, etc.) in a table

Facebook等大廠超十億用戶數據遭泄露,早該關注DID了

记一次excel XXE漏洞

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

ESP32_ FreeRTOS_ Arduino_ 1_ Create task

Image super resolution using deep revolutionary networks (srcnn) interpretation and Implementation
随机推荐
DM8 backup set deletion
Error 1045 (28000): access denied for user 'root' @ 'localhost' (using password: no/yes
C form application of C (27)
KS003基于JSP和Servlet实现的商城系统
Basic knowledge of binary tree, BFC, DFS
Introduction to data types in MySQL
Thread sleep, thread sleep application scenarios
Blue Bridge Cup - day of week
自动化测试的好处
Yyds dry goods inventory web components series (VII) -- life cycle of custom components
Cf464e the classic problem [shortest path, chairman tree]
C (XXIX) C listbox CheckedListBox Imagelist
Redis (replicate dictionary server) cache
WPF effect Article 191 box selection listbox
On Data Mining
在 .NET 6 中使用 Startup.cs 更简洁的方法
【leetcode】22. bracket-generating
ESP32_ FreeRTOS_ Arduino_ 1_ Create task
Recommended papers on remote sensing image super-resolution
WPF效果第一百九十一篇之框选ListBox