-
Read in by multiplier s1, multiplier s2
Divide S1 and S2 into 4-bit segments, and convert them into numerical values in arrays A and B; Write down the length of a, b, k1, k2;
i is assigned the lowest digit in b;
Take the ith bit from b and multiply it by a, and add it to another array c;
i:=i-1;Detection I value: less than k2 then turn, otherwise turn
-
Can you not copy the other answers? I want high precision by high precision, big brother.
-
var i,j,la,lb,len:integer;
s1,s2:string;
m:longint;
a,b,c:array[1..250] of integer;
beginreadln(s1); la:=length(s1);
for i:=1 to la do a[i]:=ord(s1[la-i+1])-48;
readln(s2); lb:=length(s2);
for i:=1 to lb do b[i]:=ord(s2[lb-i+1])-48;
for i:=1 to la do
for j:=1 to lb do
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
len:=la+lb;
for i:=1 to len do
beginc[i+1]:=c[i+1]+c[i] div 10;
c[i]:=c[i] mod 10;
end;while c[len]=0 do dec(len);
m:=c[len];
while m>0 do begin c[len]:=m mod 10;m:=m div 10;inc(len);end;
for i:=len-1 downto 1 do write(c[i]);
end.It should be easy to understand, to put it bluntly, it's just analog multiplication.
-
Take a look at the following snippets:
Input a, b array, a has n bits, b has m bits, and outputs c array.
fillchar(c,sizeof(c),0) is cleared.
for i:=1 to n do
for j:=1 to m do
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
This sentence is the key, why:
For example, 123*456
Considering the multiplication of the ith digit of the number A and the jth digit of the number b, you might as well take 2 for i and 3 for j, then a[i]=2 a[j]=4 (taken in reverse order) is 20*400
Do you see it, it's a 4-digit number, but it's not necessarily, it could be a 5-digit number, but the common denominator is that there are 3 zeros at the end.
That is. a[i]*10^(i-1)*b[j]*10^(j-1)--a[i]*b[j])*10^(i+j-2)
So it's stored in c[i+j-1].
for i:=1 to n+m do multiply two numbers by the maximum n+m digits.
beginc[i+1]:=c[i+1]+c[i] div 10;
c[i]:=c[i] mod 10;
end;The previous step did not take into account the carrying, and here one wave has processed all the carrying}
Don't capitalize it, no, it hurts to look at your head.
Again, let's break down the problem and analyze it step by step: >>>More
Greetings. I am pastor's father, Jones Maxwell Harth, a volunteer working with the Children** Society (United Nations International Children's Education**), where the base for my good oversight funds means for the Children's ** Society, and I am appointed to volunteer work with the World Bank Fact-Finding Special. >>>More
Your relationship is indeed delicate, it can be seen that it is more than a friend's relationship, but it is not yet love, only one step away. >>>More
I hear the wind calling your name.
It tells me the family again. >>>More