about summary refs log tree commit diff
path: root/12/TP-2008/R1
diff options
context:
space:
mode:
Diffstat (limited to '12/TP-2008/R1')
-rwxr-xr-x12/TP-2008/R1/.BL4.pas.swpbin0 -> 12288 bytes
-rwxr-xr-x12/TP-2008/R1/BL1.PAS26
-rwxr-xr-x12/TP-2008/R1/BL2.PAS57
-rwxr-xr-x12/TP-2008/R1/BL3.PAS45
-rwxr-xr-x12/TP-2008/R1/BL4.pas26
-rwxr-xr-x12/TP-2008/R1/CLB.IN4
-rwxr-xr-x12/TP-2008/R1/CLB.OU0
-rwxr-xr-x12/TP-2008/R1/R1.DOCbin0 -> 79872 bytes
8 files changed, 158 insertions, 0 deletions
diff --git a/12/TP-2008/R1/.BL4.pas.swp b/12/TP-2008/R1/.BL4.pas.swp
new file mode 100755
index 0000000..013c8d2
--- /dev/null
+++ b/12/TP-2008/R1/.BL4.pas.swp
Binary files differdiff --git a/12/TP-2008/R1/BL1.PAS b/12/TP-2008/R1/BL1.PAS
new file mode 100755
index 0000000..6931b1b
--- /dev/null
+++ b/12/TP-2008/R1/BL1.PAS
@@ -0,0 +1,26 @@
+uses math;
+
+var
+  f : text;
+  m, n, i : byte;
+  a, b : double;
+j
+begin
+  assign(f, 'LT.IN');
+  reset(f);
+  read(f, n, m);
+  close(f);
+  a := 1;
+  for i := 1 to n do
+    a := a * 2;
+  b := 1;
+  for i := 1 to m do
+    b := b * 3;
+  a := a + b;
+  for i := 1 to trunc(log10(a)) do
+    a := a / 10;
+  assign(f, 'LT.OU');
+  rewrite(f);
+  writeln(f, trunc(a));
+  close(f)
+end.
diff --git a/12/TP-2008/R1/BL2.PAS b/12/TP-2008/R1/BL2.PAS
new file mode 100755
index 0000000..e228240
--- /dev/null
+++ b/12/TP-2008/R1/BL2.PAS
@@ -0,0 +1,57 @@
+type
+  rect = record
+    a : longint;
+    b : longint
+  end;
+  arec = array of rect;
+
+var
+  f : text;
+  c, d, e : rect;
+
+function join(g, h : rect) : arec;
+  var n : byte = 0;
+  procedure j01n(p, q : longint);
+    begin
+      inc(n);
+      setlength(join, n);
+      join[n - 1].a := p;
+      join[n - 1].b := q
+    end;
+  begin
+    if g.a = h.a then j01n(g.a, g.b + h.b);
+    if g.a = h.b then j01n(g.a, g.b + h.a);
+    if g.b = h.a then j01n(g.b, g.a + h.b);
+    if g.b = h.b then j01n(g.b, g.a + h.a);
+  end;
+
+procedure out(m : longint);
+  begin
+    assign(f, 'GH.OU');
+    rewrite(f);
+    writeln(f, m);
+    close(f);
+    halt
+  end;
+
+procedure libl2(x, y, z : rect);
+  var i, j : rect;
+  begin
+    for i in join(x, y) do
+      for j in join(z, i) do
+        if (j.a = j.b) and (j.a <> 0) then
+          out(j.a)
+  end;
+
+begin
+  assign(f, 'GH.IN');
+  reset(f);
+  readln(f, c.a, c.b);
+  readln(f, d.a, d.b);
+  readln(f, e.a, e.b);
+  close(f);
+  libl2(c, d, e);
+  libl2(d, e, c);
+  libl2(e, c, d);
+  out(0)
+end.
diff --git a/12/TP-2008/R1/BL3.PAS b/12/TP-2008/R1/BL3.PAS
new file mode 100755
index 0000000..a49b4d6
--- /dev/null
+++ b/12/TP-2008/R1/BL3.PAS
@@ -0,0 +1,45 @@
+type ar = array[0..3] of longint;
+
+var
+  f : text;
+  m, n, i, j : shortint;
+  a : array[1..101, -1..102] of longint;
+  tmp, max : longint;
+
+function next(x, y : shortint) : ar;
+  begin
+    next[0] := a[x + 1, y - 2];
+    next[1] := a[x + 1, y + 2];
+    next[2] := a[x + 2, y - 1];
+    next[3] := a[x + 2, y + 1]
+  end;
+
+begin
+  for i := 1 to 101 do
+    for j := -1 to 102 do
+      a[i, j] := 0;
+  assign(f, 'QM.IN');
+  reset(f);
+  readln(f, m, n);
+  for i := 1 to m do
+    for j := 1 to n do
+      read(f, a[i, j]);
+  close(f);
+  for i := m - 1 downto 1 do
+    for j := 1 to n do
+      begin
+        max := 0;
+        for tmp in next(i, j) do
+          if tmp > max then
+            max := tmp;
+        a[i, j] := a[i, j] + max;
+      end;
+  assign(f, 'QM.OU');
+  rewrite(f);
+  max := 0;
+  for i := 1 to n do
+    if a[1, i] > max then
+      max := a[1, i];
+  writeln(f, max);
+  close(f);
+end.
diff --git a/12/TP-2008/R1/BL4.pas b/12/TP-2008/R1/BL4.pas
new file mode 100755
index 0000000..94dd3ba
--- /dev/null
+++ b/12/TP-2008/R1/BL4.pas
@@ -0,0 +1,26 @@
+var
+  f : text;
+  n : word;
+  a, b : array of longword;
+  tmp0, tmp1 : longword;
+
+procedure ins(var l : array of longword; x : longword);
+  begin
+    setlength(l, length(l) + 1);
+    l[length(l) - 1] := x
+  end;
+
+begin
+  setlength(a, 0);
+  setlength(b, 0);
+  assign(f, 'CLB.IN');
+  reset(f);
+  readln(f, n);
+  for i := 1 to n do
+    begin
+      readln(f, tmp0, tmp1);
+      ins(a, tmp0);
+      ins(b, tmp1)
+    end;
+  close(f);
+  
diff --git a/12/TP-2008/R1/CLB.IN b/12/TP-2008/R1/CLB.IN
new file mode 100755
index 0000000..662c775
--- /dev/null
+++ b/12/TP-2008/R1/CLB.IN
@@ -0,0 +1,4 @@
+3
+7 9
+3 8
+10 20
diff --git a/12/TP-2008/R1/CLB.OU b/12/TP-2008/R1/CLB.OU
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/12/TP-2008/R1/CLB.OU
diff --git a/12/TP-2008/R1/R1.DOC b/12/TP-2008/R1/R1.DOC
new file mode 100755
index 0000000..5e29da2
--- /dev/null
+++ b/12/TP-2008/R1/R1.DOC
Binary files differ