Compare commits
2 Commits
4a5eeb8cf0
...
0359bacf47
| Author | SHA1 | Date |
|---|---|---|
|
|
0359bacf47 | |
|
|
ed3b577516 |
|
|
@ -10,6 +10,12 @@ public record Coordinate(long X, long Y)
|
|||
|
||||
public static Coordinate operator +(Coordinate left, Coordinate right) =>
|
||||
new(left.X + right.X, left.Y + right.Y);
|
||||
|
||||
public static Coordinate operator -(Coordinate left, Coordinate right) =>
|
||||
new(left.X - right.X, left.Y - right.Y);
|
||||
|
||||
public static Coordinate operator *(Coordinate coord, int amount) =>
|
||||
new(coord.X * amount, coord.Y * amount);
|
||||
}
|
||||
|
||||
public record Coordinate3d(long X, long Y, long Z)
|
||||
|
|
@ -22,4 +28,10 @@ public record Coordinate3d(long X, long Y, long Z)
|
|||
|
||||
public static Coordinate3d operator +(Coordinate3d left, Coordinate3d right) =>
|
||||
new(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
|
||||
|
||||
public static Coordinate3d operator -(Coordinate3d left, Coordinate3d right) =>
|
||||
new(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
|
||||
|
||||
public static Coordinate3d operator *(Coordinate3d coord, int amount) =>
|
||||
new(coord.X * amount, coord.Y * amount, coord.Z * amount);
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class Day12 : IPuzzleSolver<long>
|
|||
private int GetMinTotalPresentArea(int[] presentCounts, int[] presentSizes)
|
||||
{
|
||||
return presentCounts
|
||||
.Select((presentCount, index) => presentCount * presentSizes[index])
|
||||
.Zip(presentSizes, (count, size) => count * size)
|
||||
.Sum();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue