当前位置:网站首页>[cf] 803 div2 A. XOR Mixup
[cf] 803 div2 A. XOR Mixup
2022-06-30 12:07:00 【*DDL_ GzmBlog】
Preface
t a g : tag : tag: violence
Exclusive or
Portal :
The question
Given an array A A A, among n − 1 n-1 n−1 The number is the original array , Another number n − 1 n-1 n−1 XOR of numbers , Ask about any permutation given , What is the value of this number
Ideas
Because the array can be divided into two parts , n − 1 n-1 n−1 and 1 1 1, Again because There must be a solution
So the XOR sum of the whole array is 0 0 0, So just pick one
Mycode
void solve(){
cin>>n;
for(int i = 1;i<=n;i ++ ) cin>>a[i];
for(int i = 1;i<=n;i++){
int res =0 ;
for(int j = 1; j <=n ; j++ ){
if(i == j) continue;
res ^= a[j];
}
if(res == a[i]){
cout<<a[i]<<endl;
return;
}
}
}
边栏推荐
- AutoCAD - len command
- wallys/600VX – 2×2 MIMO 802.11ac Mini PCIe Wi-Fi Module, Dual Band, 2,4GHz / 5GHz QCA 9880
- Review the writing software with characteristics
- 串行通信接口8250
- [cf] 803 div2 A. XOR Mixup
- NoSQL——Redis的配置与优化
- Global Capital Market 101:国内高净值人群最好的投资标的之一BREIT
- shell第一个命令结果传入第二个命令删除
- WebView, Scrollview sliding conflict correction
- Flutter 从零开始 006 单选开关和复选框
猜你喜欢
If it is not listed again, Kuangshi technology will not be able to endure
1175. prime permutation
zabbix监控TCP连接个数
用于生成学习任务的量子神经网络2022最新综述
Our company has used this set of general solutions for 7 years, and has opened up dozens of systems, a stable batch!
MySQL 内置函数
Quel est le rôle du rétroéclairage LED?
Paper interpretation (AGC) attributed graph clustering via adaptive graph revolution
Who still remembers "classmate Zhang"?
wallys/IPQ8074a/2x(4 × 4 or 8 × 8) 11AX MU-MIMO DUAL CONCURRENT EMBEDDEDBOARD
随机推荐
AutoCAD - len command
Redis - SDS simple dynamic string
Flutter 从零开始 007 输入框
Hannaiping of Qilin software: the construction of Digital China needs its own open source root community
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
Time function and clock_ Differences between gettime() functions
Flutter 从零开始 005 图片及Icon
Re understand oauth2.0 protocol for joint login
led背光板的作用是什么呢?
He was the first hero of Shanghai's two major industries, but died silently in regret
Who still remembers "classmate Zhang"?
构造函数、类成员、析构函数调用顺序
Talk about how to do hardware compatibility testing and quickly migrate to openeuler?
"War" caused by a bottle of water
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram, and_ Set the alpha parameter in the point parameter to specify the transparency level of data points (points transparent
Redis - ziplist compressed list
【云原生 | Kubernetes篇】深入了解Deployment(八)
Review the writing software with characteristics
R语言ggplot2可视化:使用ggplot2可视化散点图、使用scale_color_viridis_d函数指定数据点的配色方案
Shutter 007 input field from zero