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

 
Flippa

Tìm ý tưởng Keyword Research cho website từ Flippa

Khi bạn bắt đầu làm một trang web để kiếm tiền từ Google Adsense, bạn thường quan tâm rằng không biết sau những tháng ngày SEO từ khóa lên hạng 1 rồi, trang web có được lượng visit như mong muốn không.

Hướng dẫn tạo multi-step forms có sử dụng ctools multistep wizard

In the previous post I gave an example of Ctools modal API as being operated with a single form. In this one you'll be given an insight into my experiences with another powerful tool, namely Ctools multistep wizard as being used with or without the modal API involvement.

Hướng dẫn tăng tốc độ xây dựng Gatsby trong xử lý hình ảnh của Drupal

Hướng dẫn tăng tốc độ xây dựng Gatsby trong xử lý hình ảnh của Drupal

Drupal Backender Learns Gatsby: Speed up Gatsby Builds With Drupal Image Processing

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

 

Diet con trung