ITGUY19 - Editorial

Problem: https://www.codechef.com/PBK12020/problems/ITGUY19

DIFFICULTY:

EASY.

PROBLEM:

Sad story of Chef- Chef created muliple pairs of laddus with each pair having unique sweetness. Laddus can be identified by it’s sweetness only. All laddus are identical physically. Chef kept all the laddus in one basket.(Randomly, not in pair-order). After that Cheffina came and ate one laddu without informing to the chef. After that Chef came and found that one laddu was missing. After that there were NN laddus, the chef wanted to know which laddu was missing?

Program:

#include<bits/stdc++.h>
using namespace std;
#define ll long long;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int t;
cin>>t;
while(t--)
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<n;++i){
		int a;
		cin>>a;
		ans^=a;
	}
	cout<<ans<<"\n";
}

}

1 Like