diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-11-06 11:13:14 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-11-06 11:13:14 +0700 |
commit | 7de121c4b4ef888a0d1990c27144a7f9dd8c5f94 (patch) | |
tree | 2a298c9a957ad490cf8251ab264413f4effa9dce /12/TP-2009/R2/BAI3.PAS | |
parent | e4767bb46d1d759f9c863704e3f347d2a0c8c49a (diff) | |
download | cp-7de121c4b4ef888a0d1990c27144a7f9dd8c5f94.tar.gz |
Thêm đề HSG 12 huyện Vĩnh Tường, Vĩnh Phúc
Diffstat (limited to '12/TP-2009/R2/BAI3.PAS')
-rwxr-xr-x | 12/TP-2009/R2/BAI3.PAS | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/12/TP-2009/R2/BAI3.PAS b/12/TP-2009/R2/BAI3.PAS deleted file mode 100755 index 30eecdf..0000000 --- a/12/TP-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. |