HDU2095(异或运算)
来源:互联网 发布:php 获取header 编辑:程序博客网 时间:2024/04/30 15:00
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2095
解题思路:
把所有数都做异或运算,结果一定是出现奇数的那个数。因为出现偶数次的数,做异或后为0.
完整代码:
#include <functional>#include <algorithm>#include <iostream>#include <fstream>#include <sstream>#include <iomanip>#include <numeric>#include <cstring>#include <climits>#include <cassert>#include <complex>#include <cstdio>#include <string>#include <vector>#include <bitset>#include <queue>#include <stack>#include <cmath>#include <ctime>#include <list>#include <set>#include <map>using namespace std;#pragma comment(linker, "/STACK:102400000,102400000")typedef long long LL;typedef double DB;typedef unsigned uint;typedef unsigned long long uLL;/** Constant List .. **/ //{const int MOD = int(1e9)+7;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f3f3f3f3f3f3fLL;const DB EPS = 1e-9;const DB OO = 1e20;const DB PI = acos(-1.0); //M_PI;int main(){ #ifdef DoubleQ freopen("in.txt","r",stdin); #endif int n; while(~scanf("%d",&n)) { if(n == 0) break; int k; int sum; for(int i = 0 ; i < n ; i ++) { scanf("%d",&k); if(i == 0) sum = k; else sum ^= k; } printf("%d\n",sum); }}
0 0
- HDU2095(异或运算)
- hdu2095异或
- hdu2095异或处理
- hdu2095异或问题
- hdu2095 异或法
- hdu2095 像水题的不错题 异或运算
- 异或的经典运用hdu2095
- hdu2095 find your present (2)(异或)
- hdu2095
- hdu2095
- hdu2095
- HDU2095
- HDU2095解题报告(抑或运算)
- HDU2095 Map Stl 或异 找出奇数个数的数字 map stl 是啥!!!!
- 异或运算
- 异或运算符
- 异或运算
- C#异或运算
- Ubuntu之apt-get常用命令
- web2141215
- 安装ipa
- UEFI申请内存
- Log4cpp
- HDU2095(异或运算)
- Spring中RestTemplate使用例子
- java日期选择控件
- nyoj 1063 - 生活的烦恼 二叉树重建及遍历
- 第16周 项目4-为动态数组扩容
- 基于MySQL Connector/C++的数据库连接池
- webapi20141215_2
- ubuntu,grub分辨率问题。
- uefi获取屏幕输入