kikit
6/23/2016 - 5:09 PM

Find the Missing Number

Find the Missing Number

/*
http://ideone.com/OsVuDg
http://www.geeksforgeeks.org/find-the-missing-number/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=414
*/

#include <iostream>
#include <string>
#include <vector>
using namespace std; 

int main() {
	int t, n, x;
	cin >> t;
	while(t--){
		cin >> n;
		int xorA =0, xorB = 0;
		for(int i=0; i<n-1; i++){
			cin >> x;
			xorA = xorA ^ x;
		}
		for(int i=1; i<=n; i++)
			xorB = xorB ^ i;
			
		cout << (xorA ^ xorB) << endl;
	}
	return 0;
}