reformating day-18

This commit is contained in:
Dylan Thies
2023-12-19 10:11:27 -05:00
parent 43309b2079
commit b55b0374f5
2 changed files with 22 additions and 18 deletions

View File

@@ -61,10 +61,14 @@ pub fn part1(input: &str) -> String {
let dist = (*b - *a).abs();
dist.x + dist.y
};
let area = (corners.iter().tuple_windows().map(|(a,b)| {
a.x * b.y -a.y *b.x
}).sum::<i64>() + perimeter
)/2 +1;
let area = (corners
.iter()
.tuple_windows()
.map(|(a, b)| a.x * b.y - a.y * b.x)
.sum::<i64>()
+ perimeter)
/ 2
+ 1;
area.to_string()
}