class Solution {
public:
vector<int> FindNumsAppearOnce(vector<int>& array) {
vector<int>ans;
int ans1 = 0,ans2 = 0;
int XORsum = 0;
for(int i = 0 ; i < array.size() ; i++)
{
XORsum ^= array[i];
}
int t = 1;//找出异或和中哪一位是1
while((XORsum&t)==0)
{
t=t<<1;
}
for(int i = 0 ; i < array.size() ; i++)
{
if(t&array[i])
{
ans1 ^= array[i];
}
else{
ans2 ^= array[i];
}
}
ans.push_back(min(ans1,ans2));
ans.push_back(max(ans1,ans2));
return ans;
}
};</int></int></int>