summary refs log tree commit diff homepage
path: root/2021/day02.pl
blob: 30dc1d12ac0e0eb53f6bcef52c43a7a75f229b57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use warnings;
my ($depth, $pos) = (0, 0);
my ($depth2, $pos2, $aim) = (0, 0, 0);
while (<>) {
	if (/forward (\d+)/) {
		$pos += $1;
		$pos2 += $1;
		$depth2 += $aim * $1;
	} elsif (/down (\d+)/) {
		$depth += $1;
		$aim += $1;
	} elsif (/up (\d+)/) {
		$depth -= $1;
		$aim -= $1;
	}
}
print $depth * $pos, "\n";
print $depth2 * $pos2, "\n";
lass='nohover-highlight'> One of the most frequent questions on the mailing list relates to the idle time in the repository list. The answer to this is to use the "agefile" feature to calculate the time of the last change whenever the repository receives changes. Add a sample post-receive hook in a new "contrib" directory so that we can just point people at the repository in the future. Signed-off-by: John Keeping <john@keeping.me.uk> 2015-05-14git: update to v2.4.1Christian Hesse Update to git version v2.4.1, no changes required. Signed-off-by: Christian Hesse <mail@eworm.de> 2015-03-18ui-shared: allow remote refs in branch switcherChristian Hesse Signed-off-by: Christian Hesse <mail@eworm.de> 2015-03-14git: update to v2.3.3Christian Hesse Update to git version v2.3.3, no changes required. Signed-off-by: Christian Hesse <mail@eworm.de> 2015-03-13Bump versionJason A. Donenfeld 2015-03-13Remove no-op link from submodule entriesLukas Fleischer