Friday, March 18, 2016

SPOJ Problem OLOLO

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

SPOJ Problem ONEZERO

Ones and zeros Explanation: A very good problem to practice BFS skills. I think that much hint is good to give the problem a shot. An...