diff options
Diffstat (limited to '12/TP-HN-2010')
-rwxr-xr-x | 12/TP-HN-2010/BAI1.PAS | 30 | ||||
-rwxr-xr-x | 12/TP-HN-2010/BAI2.PAS | 40 | ||||
-rwxr-xr-x | 12/TP-HN-2010/BAI3 | bin | 0 -> 132580 bytes | |||
-rwxr-xr-x | 12/TP-HN-2010/BAI3.INP | 1 | ||||
-rwxr-xr-x | 12/TP-HN-2010/BAI3.OUT | 0 | ||||
-rwxr-xr-x | 12/TP-HN-2010/BAI3.o | bin | 0 -> 4344 bytes | |||
-rwxr-xr-x | 12/TP-HN-2010/BAI3.pas | 73 | ||||
-rw-r--r-- | 12/TP-HN-2010/README.md | 1 | ||||
-rwxr-xr-x | 12/TP-HN-2010/TP-2010.png | bin | 0 -> 1251665 bytes | |||
-rw-r--r-- | 12/TP-HN-2010/_BAI3.pas | 73 |
10 files changed, 218 insertions, 0 deletions
diff --git a/12/TP-HN-2010/BAI1.PAS b/12/TP-HN-2010/BAI1.PAS new file mode 100755 index 0000000..029201d --- /dev/null +++ b/12/TP-HN-2010/BAI1.PAS @@ -0,0 +1,30 @@ +var + f : text; + i : 1..30; + a : array[0..30] of qword; + +function gcd(a, b : qword) : qword; + var tmp : qword; + begin + while b > 0 do + begin + tmp := b; + b := a mod b; + a := tmp + end; + gcd := a + end; + +begin + assign(f, 'bai1.inp'); + reset(f); + readln(f, a[0]); + for i := 1 to a[0] do read(f, a[i]); + close(f); + for i := a[0] - 1 downto 1 do + a[i] := a[i] * a[i + 1] div gcd(a[i], a[i + 1]); + assign(f, 'bai1.out'); + rewrite(f); + writeln(f, a[1]); + close(f) +end. 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. diff --git a/12/TP-HN-2010/BAI3 b/12/TP-HN-2010/BAI3 new file mode 100755 index 0000000..7b83e7b --- /dev/null +++ b/12/TP-HN-2010/BAI3 Binary files differdiff --git a/12/TP-HN-2010/BAI3.INP b/12/TP-HN-2010/BAI3.INP new file mode 100755 index 0000000..3609812 --- /dev/null +++ b/12/TP-HN-2010/BAI3.INP @@ -0,0 +1 @@ +5 5 0 diff --git a/12/TP-HN-2010/BAI3.OUT b/12/TP-HN-2010/BAI3.OUT new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/12/TP-HN-2010/BAI3.OUT diff --git a/12/TP-HN-2010/BAI3.o b/12/TP-HN-2010/BAI3.o new file mode 100755 index 0000000..7706cd6 --- /dev/null +++ b/12/TP-HN-2010/BAI3.o Binary files differdiff --git a/12/TP-HN-2010/BAI3.pas b/12/TP-HN-2010/BAI3.pas new file mode 100755 index 0000000..aedf9a0 --- /dev/null +++ b/12/TP-HN-2010/BAI3.pas @@ -0,0 +1,73 @@ +type + board = array[0..31, 0..31] of boolean; + +var + f : text; + a : board; + i, j, k, l, m, n : byte; + +function king( + e : board; + x, y : byte +) : board; + var z, t : byte; + begin + for z := x - 1 to x + 1 do + for t := y - 1 to y + 1 do + e[z, t] := true; + exit(e) + end; + +function full(c : board) : boolean; + var d : boolean; + begin + for d in c do + if not(d) then + exit(false); + exit(true) + end; + +function libai3( + b : board; + x0, y0 : byte +) : byte; + type tmp = record + n, x, y : byte + end; + var + max : tmp; + t, x, y : byte; + begin + if full(b) then exit(0); + max.n := 0; + for x := x0 to m do + for y := y0 to n do + if not(b[x, y]) then + begin + t := libai3(king(b, x, y), x + 1, y + 1) + 1; + writeln(t); + if t > max.n then + begin + max.x := x; + max.y := y; + max.n := t + end + end; + exit(max.n) + end; + +begin + assign(f, 'BAI3.INP'); + reset(f); + readln(f, m, n, k); + for l := 1 to k do + begin + readln(f, i, j); + a := king(a, i, j) + end; + close(f); + assign(f, 'BAI3.OUT'); + rewrite(f); + writeln(libai3(a, 1, 1)); + close(f) +end. diff --git a/12/TP-HN-2010/README.md b/12/TP-HN-2010/README.md new file mode 100644 index 0000000..625312d --- /dev/null +++ b/12/TP-HN-2010/README.md @@ -0,0 +1 @@ +![](TP-2010.png) diff --git a/12/TP-HN-2010/TP-2010.png b/12/TP-HN-2010/TP-2010.png new file mode 100755 index 0000000..7eacc66 --- /dev/null +++ b/12/TP-HN-2010/TP-2010.png Binary files differdiff --git a/12/TP-HN-2010/_BAI3.pas b/12/TP-HN-2010/_BAI3.pas new file mode 100644 index 0000000..09ec0ca --- /dev/null +++ b/12/TP-HN-2010/_BAI3.pas @@ -0,0 +1,73 @@ +type + board = array[0..1023] of boolean; + +var + f : text; + a : board; + i, j, k, l, m, n : byte; + +function king( + e : board; + x, y : byte +) : board; + var z, t : byte; + begin + for z := x - 1 to x + 1 do + for t := y - 1 to y + 1 do + e[z, t] := true; + exit(e) + end; + +function full(c : board) : boolean; + var d : boolean; + begin + for d in c do + if not(d) then + exit(false); + exit(true) + end; + +function libai3( + b : board; + x0, y0 : byte +) : byte; + type tmp = record + n, x, y : byte + end; + var + max : tmp; + t, x, y : byte; + begin + if full(b) then exit(0); + max.n := 0; + for x := x0 to m do + for y := y0 to n do + if not(b[x, y]) then + begin + t := libai3(king(b, x, y), x + 1, y + 1) + 1; + writeln(t); + if t > max.n then + begin + max.x := x; + max.y := y; + max.n := t + end + end; + exit(max.n) + end; + +begin + assign(f, 'BAI3.INP'); + reset(f); + readln(f, m, n, k); + for l := 1 to k do + begin + readln(f, i, j); + a := king(a, i, j) + end; + close(f); + assign(f, 'BAI3.OUT'); + rewrite(f); + writeln(libai3(a, 1, 1)); + close(f) +end. |