day 2
This commit is contained in:
parent
e9578d9baa
commit
ec615662a4
5
d02/d02_1.awk
Normal file
5
d02/d02_1.awk
Normal file
@ -0,0 +1,5 @@
|
||||
BEGIN { h = 0; d = 0; a = 0; }
|
||||
$1 == "forward" { h+=+$2; d+=+$2*a; }
|
||||
$1 == "up" { a-=+$2 }
|
||||
$1 == "down" { a+=+$2 }
|
||||
END { print h*d }
|
6
d02/sample
Normal file
6
d02/sample
Normal file
@ -0,0 +1,6 @@
|
||||
forward 5
|
||||
down 5
|
||||
forward 8
|
||||
up 3
|
||||
down 8
|
||||
forward 2
|
Loading…
x
Reference in New Issue
Block a user