about summary refs log tree commit diff
path: root/others/volume1/012.pas
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-11 11:37:48 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-11 11:37:48 +0700
commitdf9a0d140a7b7edef66f95aa13b5bb4488147f68 (patch)
treede213e8e6abf244426fcec5974c1cc247897f869 /others/volume1/012.pas
parent092019121ad5ef6f82cd8fe7bf6ee143fce9648d (diff)
downloadcp-df9a0d140a7b7edef66f95aa13b5bb4488147f68.tar.gz
Fast and furiously add others/volume1
Diffstat (limited to 'others/volume1/012.pas')
-rw-r--r--others/volume1/012.pas28
1 files changed, 28 insertions, 0 deletions
diff --git a/others/volume1/012.pas b/others/volume1/012.pas
new file mode 100644
index 0000000..79a91ee
--- /dev/null
+++ b/others/volume1/012.pas
@@ -0,0 +1,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.