![]() |
||||||||||
|
||||||||||
Miaomiao's FunctionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 465 Accepted Submission(s): 217 Problem Description Firstly , Miaomiao define two functions f(x) , g(x): ![]() (K is the smallest integer which satisfied x + 9 * K > 0) if ![]() For example f(20140810) = f(2 + 0 + 1 + 4 + 0 + 8 + 1 + 0) = f(16) = f(1 + 6) = f(7) = 7 Then , you are given two integers L , R( L <= R) . Answer is defined as ![]() Please caculate (Answer Mod f(Answer) + f(Answer)) Mod f(Answer). Pay attantion ! If f(Answer) = 0 , please output "Error!" Input There are many test cases. In the first line there is a number T ( T <= 50 ) shows the number of test cases. For each test cases there are two numbers L ,R ( 0 <= L,R <= 10^100 ). For your Information , L , R don't have leading zeros. Output For each opeartion , output the result. Sample Input
Sample Output
Hint The Answer is 0 and 13. So the result is Error! and 13 Mod (1 + 3) = 1 Source | ||||||||||
|