aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2021-10-13 18:21:35 +0200
committerAbigail <abigail@abigail.be>2021-10-13 18:29:16 +0200
commit0efa7000e94f1e96a2f1ee86e6db5454e1e98f96 (patch)
tree6dea188b19bf8aaabc89112c686654d68bc181ff
parentfcb5472cede9b5bbdb0feae8e7af15089f24a53c (diff)
downloadperlweeklychallenge-club-0efa7000e94f1e96a2f1ee86e6db5454e1e98f96.tar.gz
perlweeklychallenge-club-0efa7000e94f1e96a2f1ee86e6db5454e1e98f96.tar.bz2
perlweeklychallenge-club-0efa7000e94f1e96a2f1ee86e6db5454e1e98f96.zip
Pascal solution for week 134
-rw-r--r--challenge-134/abigail/README.md2
-rw-r--r--challenge-134/abigail/pascal/ch-1.p19
-rw-r--r--challenge-134/abigail/pascal/ch-2.p34
3 files changed, 55 insertions, 0 deletions
diff --git a/challenge-134/abigail/README.md b/challenge-134/abigail/README.md
index c6304e4436..58fae311a4 100644
--- a/challenge-134/abigail/README.md
+++ b/challenge-134/abigail/README.md
@@ -13,6 +13,7 @@
* [Lua](lua/ch-1.lua)
* [m4](m4/ch-1.m4)
* [Node.js](node/ch-1.js)
+* [Pascal](pascal/ch-1.p)
* [Perl](perl/ch-1.pl)
* [PHP](php/ch-1.php)
* [Python](python/ch-1.py)
@@ -31,6 +32,7 @@
* [Java](java/ch-2.java)
* [Lua](lua/ch-2.lua)
* [Node.js](node/ch-2.js)
+* [Pascal](pascal/ch-2.p)
* [Perl](perl/ch-2.pl)
* [Python](python/ch-2.py)
* [R](r/ch-2.r)
diff --git a/challenge-134/abigail/pascal/ch-1.p b/challenge-134/abigail/pascal/ch-1.p
new file mode 100644
index 0000000000..0a88f11efe
--- /dev/null
+++ b/challenge-134/abigail/pascal/ch-1.p
@@ -0,0 +1,19 @@
+Program XXX;
+
+(* *)
+(* See ../README.md *)
+(* *)
+
+(* *)
+(* Run as: fpc -och-1.out ch-1.p; ./ch-1.out < input-file *)
+(* *)
+
+var
+ tails: array [1 .. 5] of integer = (789, 798, 879, 897, 978);
+ i: integer;
+
+begin
+ for i := 1 to 5 do begin
+ writeln (1023456000 + tails [i]);
+ end
+end.
diff --git a/challenge-134/abigail/pascal/ch-2.p b/challenge-134/abigail/pascal/ch-2.p
new file mode 100644
index 0000000000..b255ae62d6
--- /dev/null
+++ b/challenge-134/abigail/pascal/ch-2.p
@@ -0,0 +1,34 @@
+Program XXX;
+
+(* *)
+(* See ../README.md *)
+(* *)
+
+(* *)
+(* Run as: fpc -och-2.out ch-2.p; ./ch-2.out < input-file *)
+(* *)
+
+var
+ n, m, i, j, count: integer;
+ seen: array of integer;
+
+begin
+ while (not eof) do begin
+ readln (n, m);
+ setLength (seen, n * m);
+ for i := 1 to n * m do begin
+ seen [i] := 0;
+ end;
+ count := 0;
+ for i := 1 to n do begin
+ for j := 1 to m do begin
+ if seen [i * j] = 0
+ then begin
+ count := count + 1;
+ seen [i * j] := 1;
+ end
+ end
+ end;
+ writeln (count);
+ end
+end.