diff options
| author | Abigail <abigail@abigail.be> | 2021-10-12 20:05:55 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-10-13 01:54:38 +0200 |
| commit | 55ef5170b12d97c33852518d6aae1531ec7e221e (patch) | |
| tree | 805b84f027b0b453f4e6c6fb3f9639158ec077c2 /challenge-134/abigail/bc | |
| parent | 2ba1944044994f98155f20da0f14aa8b2d9a5dd9 (diff) | |
| download | perlweeklychallenge-club-55ef5170b12d97c33852518d6aae1531ec7e221e.tar.gz perlweeklychallenge-club-55ef5170b12d97c33852518d6aae1531ec7e221e.tar.bz2 perlweeklychallenge-club-55ef5170b12d97c33852518d6aae1531ec7e221e.zip | |
bc solutions for week 134
Diffstat (limited to 'challenge-134/abigail/bc')
| -rw-r--r-- | challenge-134/abigail/bc/ch-1.bc | 12 | ||||
| -rw-r--r-- | challenge-134/abigail/bc/ch-2.bc | 25 |
2 files changed, 37 insertions, 0 deletions
diff --git a/challenge-134/abigail/bc/ch-1.bc b/challenge-134/abigail/bc/ch-1.bc new file mode 100644 index 0000000000..435c743e1c --- /dev/null +++ b/challenge-134/abigail/bc/ch-1.bc @@ -0,0 +1,12 @@ +# +# See ../README.md +# + +# +# Run as: bc ch-1.bc +# +t[1] = 789; t[2] = 798; t[3] = 879; t[4] = 897; t[5] = 978 +for (i = 1; i <= 5; i ++) { + 1023456000 + t[i] +} +quit diff --git a/challenge-134/abigail/bc/ch-2.bc b/challenge-134/abigail/bc/ch-2.bc new file mode 100644 index 0000000000..a9ce05c2c4 --- /dev/null +++ b/challenge-134/abigail/bc/ch-2.bc @@ -0,0 +1,25 @@ +# +# See ../README.md +# + +# +# Run as: bc ch-2.bc < input-file +# + +while (1) { + m = read(); if (m == 0) break + n = read(); if (n == 0) break + for (i = 1; i <= m * n; i ++) { + s[i] = 0 + } + count = 0 + for (i = 1; i <= n; i ++) { + for (j = 1; j <= m; j ++) { + if (s[i * j] == 0) { + count = count + 1 + s[i * j] = 1 + } + } + } + count +} |
