当前位置:网站首页>[51nod p2106] an odd number of times [bit operation]
[51nod p2106] an odd number of times [bit operation]
2022-06-13 09:35:00 【Ayane.】
analysis :
Exclusive or
A number occurs an even number of times Their XOR value is 0 0 0 Otherwise, this number
CODE:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
int n,x,ans;
int main(){
scanf("%d",&n);
while(n--)
{
scanf("%d",&x);
ans^=x;
}
printf("%d",ans);
return 0;
}
边栏推荐
- 虚拟化和云计算文章大合集
- Yolov5 face video stream
- Solov2 nanny level tutorial (including environment configuration, training your own data set, code logic analysis, etc...) Updating ing
- Routing - static routing
- Jenkins accédant à l'authentification de l'utilisateur openldap
- 阿里高级专家剖析 | Protocol的标准设计
- LeetCode 6096. Success logarithm of spells and potions (binary search)
- Classes and objects -- encapsulation
- Tree and binary tree: basic operation and implementation of binary tree
- Online debugging tool Arthas Foundation
猜你喜欢
Acwing785. quick sort (sort+ quick sort + merge sort)
C language: deep understanding of character functions and string functions (1)
线上调试工具Arthas基础
BGP 联邦+Community
Tree and binary tree: basic operation and implementation of binary tree
turtle库的使用数字时钟模拟时钟动态显示
Classes and objects -- Inheritance
Exercise 7-10 finding specified characters (15 points)
Class loading overview
(Dijkstra + shortest circuit + by point n^2) acwing 849 Dijkstra finding the shortest path I
随机推荐
202012 CCF test questions
Calculate the number of days between two times (supports cross month and cross year)
VDD,DVDD,AVDD,VCC,AFVDD,DOVDD,IOVDD
LeetCode 5289. Fair distribution of cookies (DFS)
Solov2 source code analysis
Routing - static routing
@Value不生效及extend/implement其他类无法注入bean的手动注入
MOOC week 8 programming exercise 1
Overloading of typical operators
(state compression dp+good) acwing 291 Mondrian's dream
C language: data storage in memory
BGP Federation +community
Class loading overview
批量讀取文件夾下的全部語音文件
Spectre record
Classes and objects - initialization and cleanup of objects
Class template
谨记! 写代码别太自信! 一定要写点关键日志info输出,不然问题都定位不到。
Opencv face recognition of ros2 foxy~galactic~humble
虚拟化和云计算文章大合集