Marks :50
: 8 | : 1
A number is beautiful if the xor sum of the digits of the number is strictly greater than the average of the minimum and maximum digit of the number. Given $$$A$$$ and $$$B$$$, find the count of beautiful numbers in the range $$$[A, B]$$$.
Since the answer can be very large, output the remainder after dividing the answer by $$$10^{6}+7$$$
Note: The xor sum of the digits of a number is the bitwise XOR of all its digits.
The input consist of two space-separated integers $$$1\le A\le 10^{18}$$$ $$$1\le B\le 10^{18}$$$
Output number of beautiful integers in range $$$[A,B]$$$ modulo $$$10^{6}+7$$$
32 35
2
10 12
2
First Test Case
For 32, xor sum = 1, average of maximum and minimum digit is 2.5
For 33, xor sum = 0, average of maximum and minimum digit is 3
For 34, xor sum = 7, average of maximum and minimum digit is 3.5
For 35, xor sum = 6, average of maximum and minimum digit is 4
The beautiful numbers are 34 and 35.
Second Test Case
For 10, xor sum = 1, average of maximum and minimum digit is 0.5
For 11, xor sum = 0, average of maximum and minimum digit is 1
For 12, xor sum = 3, average of maximum and minimum digit is 1.5
The beautiful numbers are 10 and 12.
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.