commit dd69954b095e2c7082bbcb77fdfffa980c0ee704 Author: setop Date: Thu Dec 2 00:22:53 2021 +0100 day 1 diff --git a/d01/d01_1.awk b/d01/d01_1.awk new file mode 100644 index 0000000..6c92772 --- /dev/null +++ b/d01/d01_1.awk @@ -0,0 +1,16 @@ +NR == 1 { + A = $1 + next +} + +$1 > A { + N++ +} + +{ + A = $1 +} + +END { + print N +} \ No newline at end of file diff --git a/d01/d01_2.py b/d01/d01_2.py new file mode 100644 index 0000000..9e78654 --- /dev/null +++ b/d01/d01_2.py @@ -0,0 +1,8 @@ +import sys +L = [ int(l[:-1]) for l in sys.stdin.readlines() ] +Z = zip(L, L[1:], L[2:]) +M = [ a+b+c for (a,b,c) in Z] +Y = zip(M, M[1:]) +P = [ [0,1][a