about summary refs log tree commit diff
path: root/12/TP-HN-2009/R2
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
commit2f674dc80f0382f1c3178f435714960734dc9d3c (patch)
tree2abba7e4ec72bd16f58f7375126144d3fd9f4bca /12/TP-HN-2009/R2
parentb2d80610db6beda38573890ed169815e495bc663 (diff)
downloadcp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz
Reorganize stuff from secondary school
Diffstat (limited to '12/TP-HN-2009/R2')
-rw-r--r--12/TP-HN-2009/R2/BAI1.PAS90
-rw-r--r--12/TP-HN-2009/R2/BAI2.CPP58
-rw-r--r--12/TP-HN-2009/R2/BAI3.PAS87
-rw-r--r--12/TP-HN-2009/R2/R2.pdfbin103168 -> 0 bytes
4 files changed, 0 insertions, 235 deletions
diff --git a/12/TP-HN-2009/R2/BAI1.PAS b/12/TP-HN-2009/R2/BAI1.PAS
deleted file mode 100644
index b28ae0b..0000000
--- a/12/TP-HN-2009/R2/BAI1.PAS
+++ /dev/null
@@ -1,90 +0,0 @@
-uses math;
-
-var
-  f : text;
-  n : longint;
-  lena, i : integer;
-  a : array[1..512] of longint;
-
-procedure insort(x : longint);
-  var i, j : integer;
-  begin
-    inc(lena);
-    a[lena] := x - 1;
-    for i := 1 to lena do
-      if a[i] < x then begin
-        for j := lena downto i + 1 do
-          a[j] := a[j - 1];
-        a[i] := x;
-        exit
-      end
-  end;
-
-function notin(x : longint) : boolean;
-  var l, h, m : integer;
-  begin
-    l := 1;
-    h := lena;
-    repeat
-      m := (l + h) div 2;
-      if a[m] = x then exit(false);
-      if a[m] < x then h := m - 1
-      else l := m + 1
-    until l > h;
-    notin := true
-  end;
-
-procedure mklist(n0 : longint);
-  var
-    i, j : byte;
-    n10, m0 : longint;
-  begin
-    if n0 <> 0 then begin
-      insort(n0);
-      for i := 0 to trunc(log10(n0)) do
-        begin
-          n10 := 1;
-          for j := 1 to i do n10 := n10 * 10;
-          m0 := n0 div (n10 * 10) + n0 mod n10;
-          if notin(m0) then mklist(m0)
-        end
-    end
-  end;
-
-function prime(m : longint) : boolean;
-  var p, q : integer;
-  begin
-    if m < 2 then exit(false);
-    if m = 2 then exit(true);
-    if m = 3 then exit(true);
-    if m mod 2 = 0 then exit(false);
-    if m mod 3 = 0 then exit(false);
-    p := 5;
-    q := 2;
-    while p * p <= m do
-      begin
-        if m mod p = 0 then exit(false);
-        p := p + q;
-        q := 6 - q
-      end;
-    prime := true
-  end;
-
-begin
-  assign(f, 'BAI1.INP');
-  reset(f);
-  read(f, n);
-  close(f);
-  lena := 0;
-  mklist(n);
-  assign(f, 'BAI1.OUT');
-  rewrite(f);
-  for i := 1 to lena do
-    if prime(a[i]) then begin
-      writeln(f, a[i]);
-      close(f);
-      exit
-    end;
-  writeln(f, -1);
-  close(f)
-end.
diff --git a/12/TP-HN-2009/R2/BAI2.CPP b/12/TP-HN-2009/R2/BAI2.CPP
deleted file mode 100644
index a47760f..0000000
--- a/12/TP-HN-2009/R2/BAI2.CPP
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <functional>
-#include <map>
-#include <queue>
-#include <vector>
-
-#define ENC(distance, current, coupon) (((distance) << 14) + ((current) << 1) + coupon)
-#define DEC_D(data) ((data) >> 14)
-#define DEC_C(data) ((data) >> 1 & 0b1111111111111)
-#define DEC_B(data) ((data) & 1)
-
-using namespace std;
-
-int
-main()
-{
-  ifstream infile;
-  infile.open("BAI2.INP");
-  int n, m;
-  infile >> n >> m;
-  map<long long, map<long long, long long>> c;
-  long long k, i, j, l;
-  for (k = 0; k < m; k++)
-    {
-      infile >> i >> j >> l;
-      c[i][j] = l;
-    }
-  infile.close();
-
-  priority_queue<long long, vector<long long>, greater<long long>> q;
-  for (auto& item : c[1])
-    {
-      q.push(ENC(item.second, item.first, 1));
-      q.push(ENC(0, item.first, 0));
-    }
-
-  long long tmp;
-  while (!q.empty())
-    {
-      tmp = q.top();
-      q.pop();
-      if (DEC_C(tmp) == n)
-        break;
-      for (auto& item : c[DEC_C(tmp)])
-        q.push(ENC(DEC_D(tmp) + item.second, item.first, DEC_B(tmp)));
-      if (DEC_B(tmp))
-        for (auto& item : c[DEC_C(tmp)])
-          q.push(ENC(DEC_D(tmp), item.first, 0));
-    }
-
-  ofstream outfile;
-  outfile.open("BAI2.OUT");
-  outfile << DEC_D(tmp) << endl;
-  outfile.close();
-
-  return 0;
-}
diff --git a/12/TP-HN-2009/R2/BAI3.PAS b/12/TP-HN-2009/R2/BAI3.PAS
deleted file mode 100644
index 30eecdf..0000000
--- a/12/TP-HN-2009/R2/BAI3.PAS
+++ /dev/null
@@ -1,87 +0,0 @@
-type
-  ar = array of ansistring;
-
-var
-  f : text;
-  s0 : ansistring;
-  a0 : ar;
-
-function incre(s1, s2 : ansistring) : boolean;
-  var
-    i : smallint;
-  begin
-    if length(s1) < length(s2) then exit(true);
-    if length(s1) > length(s2) then exit(false);
-    for i := 1 to length(s1) do
-      begin
-        if ord(s1[i]) < ord(s2[i]) then exit(true);
-        if ord(s1[i]) > ord(s2[i]) then exit(false)
-      end;
-    exit(false)
-  end;
-
-function cal(a : ar) : smallint;
-  var
-    len, i, tmp : smallint;
-  begin
-    cal := 0;
-    i := 0;
-    len := length(a);
-    while (cal + i < len) and (i + 1 < len) do
-      begin
-        inc(i);
-        if incre(a[0], a[i]) then
-          begin
-            tmp := cal(copy(a, i, len - i)) + 1;
-            if tmp > cal then
-              cal := tmp
-          end
-      end
-  end;
-
-function putin(
-  aray : ar;
-  strng : ansistring;
-  len : smallint
-) : ar;
-  begin
-    setlength(aray, length(aray) + 1);
-    aray[length(aray) - 1] := copy(strng, 1, len);
-    exit(aray)
-  end;
-
-function libai3(
-  s : ansistring;
-  a : ar;
-  n : smallint
-) : smallint;
-  var
-    len, i, tmp : smallint;
-  begin
-    if s = '' then
-      exit(cal(a));
-    libai3 := 0;
-    len := length(s);
-    i := 0;
-    while (i < n) and (i + libai3 < len) do
-      begin
-        inc(i);
-        tmp := libai3(copy(s, i + 1, len - i), putin(a, s, i), n + 1);
-        if tmp > libai3 then
-          libai3 := tmp
-      end
-  end;
-
-begin
-  assign(f, 'BAI3.INP');
-  reset(f);
-  readln(f);
-  read(f, s0);
-  close(f);
-  setlength(a0, 1);
-  a0[0] := '';
-  assign(f, 'BAI3.OUT');
-  rewrite(f);
-  writeln(f, libai3(s0, a0, 1));
-  close(f)
-end.
diff --git a/12/TP-HN-2009/R2/R2.pdf b/12/TP-HN-2009/R2/R2.pdf
deleted file mode 100644
index 7af542a..0000000
--- a/12/TP-HN-2009/R2/R2.pdf
+++ /dev/null
Binary files differ