mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-27 05:40:32 +01:00
Implement day 03.
This commit is contained in:
@@ -31,9 +31,10 @@ namespace {
|
|||||||
assert(amount > 0 && "Must have some valid direction");
|
assert(amount > 0 && "Must have some valid direction");
|
||||||
|
|
||||||
for (std::size_t i = 0; i < amount; ++i) {
|
for (std::size_t i = 0; i < amount; ++i) {
|
||||||
|
++steps;
|
||||||
pos += dir;
|
pos += dir;
|
||||||
if (!points.count(pos)) {
|
if (!points.count(pos)) {
|
||||||
points[pos] = ++steps;
|
points[pos] = steps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
2019/tests/samples/03-1-3.in
Normal file
2
2019/tests/samples/03-1-3.in
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
R8,U5,L5,D3
|
||||||
|
U7,R6,D4,L4
|
||||||
1
2019/tests/samples/03-1-3.out
Normal file
1
2019/tests/samples/03-1-3.out
Normal file
@@ -0,0 +1 @@
|
|||||||
|
6
|
||||||
1
2019/tests/samples/03-2-3.in
Symbolic link
1
2019/tests/samples/03-2-3.in
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
03-1-3.in
|
||||||
1
2019/tests/samples/03-2-3.out
Normal file
1
2019/tests/samples/03-2-3.out
Normal file
@@ -0,0 +1 @@
|
|||||||
|
30
|
||||||
Reference in New Issue
Block a user