Similar to vertical division, multiply the remainder by 10 at a time, add the next digit of the dividend, and then divide by the divisor.
Take123456/1=11223 ... 3 as an example:
Step1:(0 *10+1)1= 0 ...1,c[6]=0, d= 1.
Step 2: (1*10+2)/1=1...1,c[5]= 1, d =/kloc.
Step 3: (1*10+3)/1=1... 2, c[4]= 1, d=2.
Step 4: (2 *10+4)/1= 2 ... 2, c[3]=2, d=2.
Step 5: (2 *10+5)/1= 2 ... 3, c[2]=2, d=3.
Step 6: (3 *10+6)/1= 3 ... 3, c[ 1]=3, d=3.
Step 7: Adjust the digits of the answer, len=5.
The final answer is: c = (5 5,3,2,2, 1, 1) and d = 3.
High precision divided by high precision:
Similar to high precision divided by low precision, but there are several points to be modified:
Modify 1: original d: = d *10+a [I]; In this sentence, d* 10 needs to be achieved by high-precision multiplication (that is, multiplying (d, 10, d); ), and +a[i] only needs d [1]: = a [i]; Do it.
Amendment 2: original c [I]: = d div b; d:= d mod b; Now these two sentences need to be constantly subtracted with high precision (that is, subtract(d, b, d); Inc(c[I]); )。
Other places are basically the same.