diff options
author | June McEnroe <june@causal.agency> | 2018-12-06 15:00:24 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-12-06 15:00:24 -0500 |
commit | dd0a150771283541eb3b97bff66259bee9bb782e (patch) | |
tree | f0d51bba2a4df14b4bf238478df1a2cbb1f6c212 | |
parent | Solve day 6 part 1 (diff) | |
download | aoc-dd0a150771283541eb3b97bff66259bee9bb782e.tar.gz aoc-dd0a150771283541eb3b97bff66259bee9bb782e.zip |
Solve day 6 part 2
-rw-r--r-- | 2018/day06.c | 12 |
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); } |