UVa 10469

From Algorithmist
Jump to navigation Jump to search

10469 - To Carry or not to Carry[edit]

Summary[edit]

Someone made some erronous way to calculate the addition of bits. You are to use his method and output a number that he would have generated.

Explanation[edit]

  • This is a relatively trivial problem if you know your logic. Using this truth table figure out which logical operator to use.
   A B AopB
   0 0  0
   1 0  1
   0 1  1
   1 1  0
  • Remember to use unsigned integers.

Implementations[edit]

Input[edit]

4 6
6 9
4000000000 1
4000000001 1

Output[edit]

2
15
4000000001
4000000000

References[edit]