about summary refs log tree commit diff
path: root/12/TP-HN-2010/BAI2.PAS
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2016-11-06 11:13:14 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2016-11-06 11:13:14 +0700
commit7de121c4b4ef888a0d1990c27144a7f9dd8c5f94 (patch)
tree2a298c9a957ad490cf8251ab264413f4effa9dce /12/TP-HN-2010/BAI2.PAS
parente4767bb46d1d759f9c863704e3f347d2a0c8c49a (diff)
downloadcp-7de121c4b4ef888a0d1990c27144a7f9dd8c5f94.tar.gz
Thêm đề HSG 12 huyện Vĩnh Tường, Vĩnh Phúc
Diffstat (limited to '12/TP-HN-2010/BAI2.PAS')
-rwxr-xr-x12/TP-HN-2010/BAI2.PAS40
1 files changed, 40 insertions, 0 deletions
diff --git a/12/TP-HN-2010/BAI2.PAS b/12/TP-HN-2010/BAI2.PAS
new file mode 100755
index 0000000..d6639df
--- /dev/null
+++ b/12/TP-HN-2010/BAI2.PAS
@@ -0,0 +1,40 @@
+var

+  f : text;

+  s : string;

+  len, i, j : byte;

+  count : integer = 0;

+

+function libai2(s0 : string) : boolean;

+  var

+    bo, boo, b0 : boolean;

+    c : char;

+  begin

+    b0 := false;

+    bo := false;

+    boo := false;

+    for c in s0 do

+      begin

+        case c of

+          '0' .. '9' : b0 := true;

+          'a' .. 'z' : bo := true;

+          'A' .. 'Z' : boo := true

+        end;

+        if b0 and bo and boo then exit(true)

+      end;

+    exit(false);

+  end;

+

+begin

+  assign(f, 'BAI2.INP');

+  reset(f);

+  read(f, s);

+  close(f);

+  len := length(s);

+  for i := 1 to len - 5 do

+    for j := 6 to len - i + 1 do

+      if libai2(copy(s, i, j)) then inc(count);

+  assign(f, 'BAI2.OUT');

+  rewrite(f);

+  writeln(f, count);

+  close(f)

+end.