#include<iostream>
#include<vector>
using namespace std;
int singlenumber(vector<int>& nums)
{
int res = 0;
for (auto &i : nums)
{
res ^= i;// 位运算进行异或运算相同为零相异为一
}
return res;
}
int main()
{
int nums[11] = { 1, 5, 6, 3, 5, 2, 1, 8, 6, 3, 8 };
vector<int>v;
v.insert(v.begin(), nums, nums+ 11);
cout << singlenumber(v)<<" ";
system("pause");
return 0;
}
最后
以上就是英勇蜗牛最近收集整理的关于给一组数字,输出只出现一次数字i的全部内容,更多相关给一组数字内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复