Xor Sum Gym
来源:互联网 发布:mysql和oracle语法区别 编辑:程序博客网 时间:2024/05/20 04:50
题目链接:https://vjudge.net/problem/Gym-100741D
题意:求n个数中出现次数为奇数次的所有数的异或值。
思路:水题,同一个值,异或两次相当于没有进行异或,所以不用求出现次数为奇数还是偶数,直接全部异或就行。
代码如下:
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>#include<queue>#include<cstdlib>#include<sstream>#include<deque>#include<stack>#include<set>#include<map>using namespace std;typedef long long ll;typedef unsigned long long ull;const double eps = 1e-6;const int maxn = 1e6 + 50;const int maxt = 300 + 10;const int mod = 10;const int dx[] = {1, -1, 0, 0};const int dy[] = {0, 0, -1, 1};const int Dis[] = {-1, 1, -5, 5};const int inf = 0x3f3f3f3f;const int MOD = 1000;int n, m, k;int main(){ int n; scanf("%d", &n); int ans; scanf("%d", &ans); int x; for(int i = 1; i < n; ++i){ scanf("%d", &x); ans ^= x; } printf("%d\n", ans); return 0;}
阅读全文
0 0
- Xor Sum Gym
- Xor Sum Gym
- hdu4825 Xor Sum【Trie、Xor】
- UVALIVE 4682: XOR Sum
- Sum of xor
- HDU 4825 Xor Sum
- 网络教室 Xor Sum
- hdu 4825 Xor Sum
- HDU 4825 Xor Sum
- HDOJ 4825 Xor Sum
- HDU-4825 Xor Sum
- HDU 4825 Xor Sum
- Xor Sum HDU
- Xor Sum HDU
- Xor Sum HDU
- hdu1825 Xor Sum
- hdoj 4825 Xor Sum
- Xor Sum HDU
- ListView + CheckBox(或者是RadioGroup等控件)的混乱选中原理
- HDU 6170 Two strings (二维DP)
- springmvc集成shiro后,session、request姓什么?
- python2/3---sort方法与sorted函数的使用
- Android 监听软键盘弹出
- Xor Sum Gym
- Windows Practice_文件搜索器(四)_封装文件扫描器
- Gym
- Codeforces 845 C Two TVs
- java lambda表达式
- Windows Practice_闹钟(一)_简易记事本
- 门面模式
- k-近邻算法
- $n$-Way Tie Gym