Motu and Alphabets
All submissions for this problem are available.Motu loves playing with English alphabets. But unfortunately someone stole all alphabets from him. Now he is asking you to get him some alphabets to play with. You have been given a range $[L, R]$ (both inclusive). Since all numbers in this range would be in decimal number system (and you won't get any alphabets from them) you decided to convert all decimal numbers in this range to hexadecimal numbers. Since hexadecimal numbers are represented using $[0, 9]$ and $[A, F]$ there is a chance that you would get some alphabets in this range. Find the total number of alphabets you can get Motu to play with in the given range. ### Input: - First line will contain $T$, number of testcases. Then the testcases follow. - Each testcase contains of a single line of input, two integers $L, R$. ### Output: For each testcase, output in a single line the total number of alphabets you can get for Motu. ### Constraints: - $1 \leq T \leq 100$ - $1 \leq L \leq R \leq 2 * 10^6$ ### Sample Input: 3 10 15 15 16 5 100 ### Sample Output: 6 1 36 ### Explanation: For the first testcase, the numbers in range $[10, 15]$ in hexadecimal number system can be represented as $A, B, C, D, E$ and $F$ respectively. Hence the total number of alphabets we can get is 6. In second testcase, the hexadecimal numbers are $F$ and $10$. Hence there is only one alphabet we can get.
|Tags||bhushan_, bhushan_, blup2019|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions