class Solution {
public:
void FindNumsAppearOnce(vector<int> data,int* num1,int *num2) {
if(data.size() <= )
return;
int resultOR = ;
for(int i = ;i < data.size();i++){
resultOR ^= data[i];
}
int resultIndex = FindFirst1(resultOR);
*num1 = ;
*num2 = ;
for(int i = ;i < data.size();i++){
if(Is1(data[i],resultIndex))
*num1 ^= data[i];
else
*num2 ^= data[i];
}
}
int FindFirst1(int num){
int index = ;
while((num & ) == ){
num = num >> ;
index++;
}
return index;
}
bool Is1(int number,int index){
number = number >> index;
return number & ;
}
};

(num&1) == 0这里必须打上括号,因为==的优先级高于&

return num&1可以不打括号

最新文章

  1. GIT常用命令笔记
  2. EXCEL处理大量数据的潜在风险
  3. PHP中的运算符---算术运算符、逻辑运算符、赋值运算符、比较运算符
  4. codeforces 500B.New Year Permutation 解题报告
  5. 【Clr in c#】泛型
  6. IE浏览器模式设置
  7. python声明文件编码,必须在文件的第一行或第二行
  8. bootstrap学习以及其插件
  9. Linux 安装Redis全过程日志
  10. ntpdate
  11. 在maven pom.xml中加载不同的properties ,如localhost 和 dev master等jdbc.properties 中的链接不一样
  12. vue_VueRouter 路由_路由器管理n个路由_并向路由组件传递数据_新标签路由_编程式路由导航
  13. gcc 找不到 boot python 链接库的问题: /usr/bin/ld: cannot find -lboost_python
  14. topcoder SRM642 div1 hard WheelofFortune
  15. PHP开发——数据类型
  16. EF-CodeFirst-数据迁移
  17. 精通Web Analytics 2.0 (12) 第十章:针对潜在的网站分析陷阱的最佳解决方案
  18. screen对象和history对象
  19. WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错
  20. 百度公共dns

热门文章

  1. cookie使用举例(添加购物车商品_移除购物车商品)
  2. linux C判断文件是否存在
  3. (转)shell实例浅谈之产生随机数七种方法
  4. (转)Python3.5 day3作业二:修改haproxy配置文件
  5. OpenCV细化算法简单解析
  6. 13、Selenium+python+API分类总结
  7. UVA 10462 —— Is There A Second Way Left?——————【最小生成树、kruskal、重边】
  8. oracle 找回被覆盖的存储过程
  9. 深入.NET框架。
  10. js中各种距离clientWidth