Download presentation
Presentation is loading. Please wait.
1
Триъгълник на Паскал
2
1. Биномни коефициенти Примери: Теорема за биномните коефициенти:
3
2. Триъгълник на Паскал ред Биномни коефициенти 1 2 3 4 5 1 1 1 2 1
1 2 3 4 5
4
3. Начини за изчисляване на биномните коефициенти
C(n,k)=C(n-1,k-1)+C(n-1,k) 5 1 10 6 15 20
5
4. Вариация 1 (двумерна таблица)
Program dtv1; Const n=9; Type pastr=array[0..n,o..n] of integer; Var pt:pastr; i,j:integer; Begin For i:=0 to n do begin pt[i,0]:=1; pt[i,i]:=1; write(pt[i,0]:4); for j:=1 to i-1 do begin pt[i,j]:=pt[i-1,j-1]+pt[i-1,j]; write(pt[i,j]:4); end; writeln(pt[i,i]:4); end End.
6
5. Вариация 2 (едномерна таблица)
Program etv2; Const n=9; nr=(n+1)*(n+2) div 2; Type pastr=array[0..nr] of integer; Var pt:pastr; i,j:integer; Function index(i,j:integer): integer; Begin index:=i*(i+1) div 2 + (j+1) end; Begin for i:=0 to n do begin pt[index(i,0)]:=1; pt[index(i,i)]:=1; write(pt[index(i,0)]:4); for j:=1 to i-1 do begin pt[index(i,j)]:=pt[index(i-1,j-1)]+pt[index(i-1,j)]; write(pt[index(i,j)]:4); end; writeln(pt[index(i,j)]:4); end End.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.