diff options
author | Thomas Voss <mail@thomasvoss.com> | 2022-12-01 21:26:32 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2022-12-01 21:26:32 +0100 |
commit | fbeaf4fde52ebb89f07564685454cfc385dddb0d (patch) | |
tree | aa24c794156f75a52c365ea214793115196c035a | |
parent | 4abaad2051f14cca06b8bff00c460a9c7541f5cb (diff) |
Ignore some files
-rw-r--r-- | 2015/02/.gitignore | 1 | ||||
-rwxr-xr-x | 2015/02/puzzle-1.awk | 20 | ||||
-rwxr-xr-x | 2015/02/puzzle-2.awk | 20 |
3 files changed, 1 insertions, 40 deletions
diff --git a/2015/02/.gitignore b/2015/02/.gitignore new file mode 100644 index 0000000..95a78b1 --- /dev/null +++ b/2015/02/.gitignore @@ -0,0 +1 @@ +puzzle-[12].awk diff --git a/2015/02/puzzle-1.awk b/2015/02/puzzle-1.awk deleted file mode 100755 index 5c05d31..0000000 --- a/2015/02/puzzle-1.awk +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/awk -f - -function min(a, b, c) { - if (a <= b && a <= c) - return a - if (b <= a && b <= c) - return b - return c -} - -BEGIN { FS = "x" } -{ - # START PART 1 - x = $1 * $2 - y = $2 * $3 - z = $1 * $3 - - sum += (2 * x) + (2 * y) + (2 * z) + min(x, y, z) -} -END { print sum } diff --git a/2015/02/puzzle-2.awk b/2015/02/puzzle-2.awk deleted file mode 100755 index 450aed9..0000000 --- a/2015/02/puzzle-2.awk +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/awk -f - -function min(a, b, c) { - if (a <= b && a <= c) - return a - if (b <= a && b <= c) - return b - return c -} - -BEGIN { FS = "x" } -{ - x = $1 + $1 + $2 + $2 - y = $2 + $2 + $3 + $3 - z = $1 + $1 + $3 + $3 - - sum += $1 * $2 * $3 + min(x, y, z) - # END PART 2 -} -END { print sum } |