High-Precision multiplication and factorial)

Source: Internet
Author: User
I. The basic idea of high-precision multiplication is the same as that of addition. The basic process is as follows:

① Read the multiplier S1 and S2
② Divide S1 and S2 into four segments and convert them into values that exist in arrays A and B. Write down the lengths of A and B, K1 and K2;
③ I is assigned the bitwise in B;
④ Obtain the multiplication of the I-th and A from B and accumulate it into the C of another array. (Note: The number of wrong digits should be
?)
⑤ I: = I-1; Detection I value: less than K2 to turn 6, otherwise turn 4
6. Print the result

Example:ProgramDownload

Program chengfa;
Const n = 100;
Type AR = array [1 .. n] of integer;
VaR A, B: Ar; K1, K2, K: integer;
C: array [1 .. 200] of integer;
S1, S2: string;
Procedure Fenge (S: string; var D: Ar; var KK: integer );
VaR SS: string;
I, code: integer;
Begin
I: = length (s );
KK: = N;
Repeat
SS: = copy (S, I-3, 4 );
Val (SS, d [Kk], Code );
KK: = kk-1;
S: = copy (s, 1, I-4 );
I: = I-4;
Until I <0;
KK: = KK + 1;
End;
Procedure daying;
VaR I: integer;
Begin
Write (C [k]);
For I: = k + 1 to 2 * n do begin
If C [I] <1000 then write ('0 ');
If C [I] <100 then write ('0 ');
If C [I] <10 then write ('0 ');
Write (C [I]);
End;
Writeln;
End;
Begin
Init;
Jisuan;
Daying;
End.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.