函数递归运算的运用算法问题,怎么采用C语言的程序的设计的思想实现?

Problem Description
Firstly , Miaomiao define two functions f(x) , g(x):

(K is the smallest integer which satisfied x + 9 * K > 0)

if e.g. g(178) = 1 - 7 + 8 = 2 , g(1) = 1 , g(1234) = 1 - 2 + 3 - 4 = -2;

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
2
0 0
0 21

Sample Output
Error!
1

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问