summary refs log tree commit diff homepage
path: root/2018
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-12-06 15:00:24 -0500
committerJune McEnroe <june@causal.agency>2020-11-22 00:14:25 -0500
commit8102eb9a838063611390cdab3c387b93020f34c7 (patch)
tree5e9915d0264fbffd54e845dbc2b6a01358a7ca70 /2018
parentSolve day 6 part 1 (diff)
downloadaoc-8102eb9a838063611390cdab3c387b93020f34c7.tar.gz
aoc-8102eb9a838063611390cdab3c387b93020f34c7.zip
Solve day 6 part 2
Diffstat (limited to '')
-rw-r--r--2018/day06.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/2018/day06.c b/2018/day06.c
index 5b9552d..c204264 100644
--- a/2018/day06.c
+++ b/2018/day06.c
@@ -49,4 +49,16 @@ int main() {
 		if (area[i] > max) max = area[i];
 	}
 	printf("%d\n", max);
+
+	int size = 0;
+	for (int x = 0; x <= maxX; ++x) {
+		for (int y = 0; y <= maxY; ++y) {
+			int sum = 0;
+			for (int i = 0; i < len; ++i) {
+				sum += dist((struct Point) { x, y }, points[i]);
+			}
+			if (sum < 10000) size++;
+		}
+	}
+	printf("%d\n", size);
 }