mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 05:10:32 +01:00
Implement day23 part 1.
This commit is contained in:
@@ -31,6 +31,18 @@ impl<T> Point for (T, T)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Point for (T, T, T)
|
||||
where T: Add<Output=T> + Sub<Output=T> + Copy + Ord
|
||||
{
|
||||
type CoordType = T;
|
||||
|
||||
fn manhattan(self, other: Self) -> T {
|
||||
let (xa, ya, za) = self;
|
||||
let (xb, yb, zb) = other;
|
||||
xa.max(xb) + ya.max(yb) + za.max(zb) - xa.min(xb) - ya.min(yb) - za.min(zb)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Apply Erathostenes's sieve to the supplied array
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user