ONOTOLE NEEDS YOUR HELP
Explanation:
One of the simplest problem on SPOJ. You just need to find XOR of all the numbers and you have the number which appeared only once.
Solution:#include<cstdio>
int main(){
int n,t,a=0;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
a ^= n;
}
printf("%d",a);
return 0;
}
Any suggestions are welcome.
No comments:
Post a Comment