about summary refs log tree commit diff
path: root/others/volume1/012.pas
blob: 79a91ee0c6d7ba327c65a3133fe11ca44a4045c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var
  n, i, j: shortint;
  pas_tri, pas_tri_old: array of int64;

begin
  readln(n);
  setlength(pas_tri_old, n + 1);
  pas_tri_old[0] := 1;
  pas_tri_old[1] := 0;
  setlength(pas_tri, n + 1);
  pas_tri[0] := 1;
  for i := 1 to n do
    pas_tri[i] := 0;
  writeln(1);
  for i := 1 to n do
    begin
      write('1 ');
      for j := 1 to i - 1 do
        begin
          pas_tri[j] := pas_tri_old[j] + pas_tri_old[j - 1];
          write(pas_tri[j], ' ')
        end;
      pas_tri[i] := 1;
      writeln(1);
      for j := 0 to n do
        pas_tri_old[j] := pas_tri[j]
    end
end.