aoc2021/d02/d02_1.awk

6 lines
119 B
Awk
Raw Permalink Normal View History

2021-12-02 08:09:35 +00:00
BEGIN { h = 0; d = 0}
$1 == "forward" { h+=+$2 }
$1 == "up" { d-=+$2 }
$1 == "down" { d+=+$2 }
END { print h, d, h*d }