LUCIFER - LUCIFER Number
Lucifer is the only human whi has defeated RA-ONE in a computer game ..
RA-One is after lucifer for revenge and G-One is there to protect him ...
All thi G-One and Ra-one Nonsense has disturbed lucifers life..
He wants to get Rid of Ra-One and kill him . He found that Ra-One can be killed only by throwing Lucifer number of weapons at him.
Any number is LUCIFER NUMBER if the Difference between Sum of digits at even location and Sum of digits at odd location is prime number .. For eg... for 20314210 is lucifer number
digits at odd location 0,2,1,0
digits at even location 1,4,3,2
diff = (1+4+3+2)-(0+2+1+0)=10-3 = 7 ..... a prime number.
Lucifer has access to a Warehouse which has lots of weapons ..
He wants to know in how many ways can he kill him.
Can you help him?
First line will have a number 't' denoting the number of test cases.
each of the following t lines will have 2 numbers 'a' , 'b'
Print single number per test case, depicting the count of Lucifer numbers in the range a,b inclusive.
6NOTE: t will be less than 100
from and to will be between 0 and 10^9 inclusive
:'( ACed. So good
Last edit: 2016-07-24 23:43:59
fastest in JAVA :P
Easy . Just Change the terminating condition in My Function and All the three problems are Done!
@Ankur Tyagi: The ones digit is in odd position, the tens digit is in even position, the hundreds digit is in odd position, etc.
why output of Test case "0 50" is only 6. Answer should be 14. Corresponding numbers for this ans are : 13 14 16 18 24 25 27 29 35 36 38 46 47 49Last edit: 2015-02-06 17:58:42
Gaurav Kumar Verma:
few test cases that might help
free mind ;):
Never expected that I will be able to get it accepted. After two days of debugging over a silly issue. :)Last edit: 2014-07-15 15:32:56
Time limit seems to be too tight - can the problem setter submit a reference solution in one of the languages that has not been accepted yet? Say Java or Python. Otherwise, limit it to C/C++/Pas.