Viết chương trình cho phép nhân hai đa thức đã sắp xếp

Viết chương trình cho phép nhân hai đa thức đã sắp xếp

Viết chương trình cho phép nhân hai đa thức đã sắp xếp.

Thuật toán:

Tích đa thức A bậc m với đa thức B bậc n là đa thức C bậc m + n. Trong đó : C[m] = Tổng của các tích A[i] * A[j] sao cho i+j = m.

Chương trình

Program Nhan_da_thuc;

Var m,n,i,j:byte;

    A, B, C: array[0..10] of real;

Begin

    Write(' Nhap bac cua da thuc A: '); Readln(m);

    For i:= m downto 0 do

    Begin

         Write('A[',i,']= '); Readln(A[i]);

    End;

    Write(' Nhap bac cua da thuc B: '); Readln(n);

    For i:= n downto 0 do

    Begin

         Write('B[',i,']= '); Readln(B[i]);

    End;

    For i:=0 to m+n do C[i]:=0;

    For i:=0 to m do

     For j:=0 to n do C[i+j]:=C[i+j]+A[i]*B[j];

    For i:= m+n downto 0 do if C[i]<>0 then Write(C[i]:3:1,'x^',i,' + ');

    Readln

End.

 

Bạn thấy bài viết này như thế nào?: 
Average: 9 (25 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Samsung Galaxy Z Review

Samsung Galaxy Z Review

Samsung recently launched a new phone in the market; the Samsung Galaxy Z. this very pretty gadget is very slim and light. This amazing phone has 480 x 800 pixels, touch screen, a multi touch in put method and comes in 16 different colors.

Kaspersky công bố phiên bản năm 2013 và chương trình Kaspersky Care

Kaspersky công bố phiên bản năm 2013 và chương trình Kaspersky Care

Ngày 16/10, Kaspersky Lab phối hợp cùng Công ty TNHH Bảo Mật Nam Trường Sơn đã tổ chức lễ ra mắt sản phẩm Kaspersky 2013 phiên bản tiếng việt “Sẵn sàng cho 20 triệu lượt download”

Xóa Duplicate Views Results trong Drupal 7

Xóa Duplicate Views Results trong Drupal 7

When you are building a Drupal site and creating views, it's not uncommon to find that your view is showing the same result multiple times.

Công ty diệt chuột T&C

 

Diet con trung