Or
Practice
3.6 (49 votes)
Operators
Math
C++
Basic math
Problem
70% Success 14232 Attempts 30 Points 2s Time Limit 256MB Memory 1053 KB Max Code
Problem Statement:
how many distinct numbers can be generated by doing bitwise OR of one or more integers between A and B (inclusive)?
Input Format:
input contains two integers A and B
Output Format:
Print the number of possible Integer that can be genrated .
Constraints :
- 1≤A≤B<260
- A and B are integers.
Sample Input
7 9
Sample Output
4
Explanation
In this case, A=7 and B=9. There are four integers that can be generated doing the bitwise OR of a non-empty subset of {7, 8, 9}: 7, 8, 9 and 15
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
No similar problems found
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor