GEEKOUNT - EVEN COUNT

Let f(x) be the product of digits of a number.

Given L and R, find the number of values of 'i' such that L <= i <= R and f(i) is even.

Input

The first line consists of an integer t, the number of test cases. For each test case, you are given the two integers L and R.

Output

For each test case, print the number of values of 'i' such that L <= i <= R and f(i) is even.

Constraints

1 <= t <= 100

1 <= L <= R <= 1000000000

Sample

Input:
2
2 12
4 23

Output:
6
12

Added by:cegprakash
Date:2013-01-15
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF
Resource:problem setter: rkarthikeyan

hide comments
2019-07-11 18:37:59
it can be tagged as [spoiler]

Last edit: 2019-09-30 14:48:31
2017-05-25 12:09:10
I used cout.precision and I got AC otherwise, I was getting WA.
2017-03-27 11:01:42
Barely 40 lines of code but took more than 1.5 hrs and two submissions
2015-08-04 22:37:23 NEXES
Calculations+Implementation!!!!!!!
2015-01-04 20:28:09 Sudharsansai
Wow...Once again a nice problem from cegprakash...
Reply : The credit for this problem goes to rkarthikeyan

Last edit: 2015-08-10 21:11:11
2014-07-16 20:05:01 Naman Goyal
Can someone please take a look at submission id 11960363. I have checked it with all the test cases available here in comments and description still getting WA. I have even checked it with brute force, cant find the test case for which it is getting failed. I really appreciate any help.

Never mind, got AC.

Last edit: 2014-07-19 17:25:58
2014-06-30 21:30:36 paras meena
@Aradhya Thnx Sir For hint 3:)
2013-04-14 22:22:54 Aradhya
I used 2-d map :D yeah :)
2013-04-14 22:22:54 Nick
@shailesh thanks, understood :)
2013-04-14 22:22:54 shail
@andrias...nopes, it is 12. becoz 21 nd 23 have digits 2, which makes the product even.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.