Initial commit
This commit is contained in:
commit
f242d2b0df
420 changed files with 62521 additions and 0 deletions
6
2021/day02/day02.awk
Normal file
6
2021/day02/day02.awk
Normal file
|
@ -0,0 +1,6 @@
|
|||
/down/ {aim += $2}
|
||||
/up/ {aim -= $2}
|
||||
/forward/ {pos += $2; depth += aim * $2}
|
||||
END {print pos * aim, pos * depth}
|
||||
# one-liner
|
||||
# /^d/{a+=$2}/u/{a-=$2}/f/{p+=$2;d+=a*$2}END{print p*a,p*d}
|
Loading…
Add table
Add a link
Reference in a new issue