Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One day, the teacher asked a student if he had knowledge of the xor-operator and he told him I don't know much, but rather I

One day, the teacher asked a student if he had knowledge of the xor-operator and he told him I don't know much, but rather I know that they deal with numbers in binary form.

The teacher told him a brief explanation about the xor-operator:

Exclusive or or exclusive disjunction is a logical operation that outputs true only when inputs differ (one is true, the other is false)

For example, the exclusive OR of 3 and 5 is 6.

(When written in base two (Binary Form): the exclusive OR of 011 and 101 is 110.)

The teacher asked the student for a task to test his understanding of this process:

That calculates the xor for a period of numbers i.e.

XOR between A and B = A XOR A + 1 XOR A + 2 ... B.

Input Format

A B

Constraints

. All values in input are integers.

. 0 A B 1000000000000

Output Format

Find XOR between A and B

Sample Input 0

2 4 

Sample Output 0

5 

Explanation 0

2 , 3 , 4 are 010, 011, 100 in binary form, respectively. The exclusive OR of these is 101, which is 5 in base ten.

Sample Input 1

123 456 

Sample Output 1

435 

Sample Input 2

123456789012 123456789012 

Sample Output 2

123456789012

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions