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
STARK:
2013-02-22 10:00:20
please explain the test case... :\ |
|
praveen123:
2013-02-22 10:00:20
@sahil sareen; You are looping over i from a to b, O(b) where b is 10^19 ,
|
|
SAHIL SAREEN:
2013-02-22 10:00:20
@pravin123 Could u please give me some hint .. getting TLE 8579705
|
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-02-22 10:00:20
@praveen123: Could you change the cluster to pyramid and rejudge all submissions, I think it's better using pyramid cluster to see more accurate running time on each submission. |
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-02-22 10:00:20
It's binary level code (low level), just like assembly, hard to write but very fast... |
|
praveen123:
2013-02-22 10:00:20
awesome , I could not understand even a line of code what you wrote :( |
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-02-22 10:00:20
yay! finally 0.02s ;-) now it's superhard to break my time record :-D |
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 |