- namespace Day6;
- public record RaceStats(int Duration, int Distance)
- {
- public int LowerBound()
- {
- var lowerBound = (-Duration + Math.Sqrt(Duration * Duration - 4 * Distance)) / (-2.0);
- var nextWhole = (int)Math.Ceiling(lowerBound);
- return nextWhole > lowerBound ? nextWhole : nextWhole + 1;
- }
- }
|