Search This Blog

Thursday 14 May 2015

UVA Problem no:10469

UVA Problem no:10469

To Carry or not to Carry

Solution:

Now for this problem,I will suggest you to know a rational operator.
"Exclusive or"  or XOR is a bitwise operation, so it operates on individual bits.
XOR operator (also called "logical addition") is defined like this:

 so as the problem stated above in the picture,we can see that Mofiz is asked to not carry the bits while adding to numbers in binary form.So, It's mean 1+1=0,
1+0=1, 0+1=1 which exactly like exclusive or operator.
So,This is the code,
If you still can't understand,You can comment.I will try to explain.Thank you.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. i cannot understants the code fully .bassically the exclusive or orXOR

    ReplyDelete