CNT_LUCK - Counting Lucky Numbers
Find out how many numbers between a and b (inclusive) when represented as binary numbers have sum of digits lucky.
A number is lucky if its decimal representation contains digits 4 and 7 only.
eg. 4, 7, 47, 77 etc. where as 14, 41 etc. are not.
Note that 0 <= a <= b <= 10^19.
Input
T: number of test cases T<=10^5
Next T lines have a and b in every line. a <= b
Output
for every test case output as described in problem statement
Example
Input: 2 15 15 63 63 Output: 1 0
hide comments
shubhamgoyal__:
2016-06-22 07:56:36
Take care of the case when a=b=0.Answer must be 0. |
|
Medo:
2015-08-24 12:42:49
I passed a 10000 random generated test cases against an AC code however I keep getting a WA...
|
|
P_Quantum:
2014-02-28 17:53:29
nice prblm :) |
|
Utsav Sinha:
2013-06-28 18:05:22
Point to be Noted : "44" is a lucky number. Got WA due to it :(
|
|
edoc:
2013-06-23 09:09:17
@pravin123 can we take input in c++ as unsigned long long.. or we are to use string?? |
|
Kartik Khare:
2013-06-07 05:16:07
I am pretty much sure i have the correct solution but still not getting AC..
|
|
Problem Solver:
2013-02-22 10:00:20
Please help with that :-) If you can, mail me knifemod at gmail or just give some test case here... Would greatly appreciate. thanks. |
|
Problem Solver:
2013-02-22 10:00:20
Thanks for an answer, but i still cant understand what could i misunderstood in contraits. Valuesfit in unsigned long long and are positive. Could you help me with that or point what am doing wrong? Thanks in advance... |
|
praveen123:
2013-02-22 10:00:20
@ Problem Solver , your code was not working on some test cases. I think that you have misunderstood the constraints , Please see the constraints.
|
|
Problem Solver:
2013-02-22 10:00:20
Very nice problem, but i'm having a little problem with this. I'm almost sure that i have correct solution. Although i can't get AC, this is my solution : 8662732
|
Added by: | praveen123 |
Date: | 2013-01-21 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | general |