private (int Ytop, int Hits) Solve() { var target = Target.Parse(_input); var xvelmin = 0; for (int i = 0; i < target.Xmin; i += xvelmin) { xvelmin++; } var ytop = 0; var hits = 0; for (int yvel = target.Ymin; yvel <= -target.Ymin; yvel++) { for (int xvel = xvelmin; xvel <= target.Xmax; xvel++) { var probe = new Probe(xvel, yvel); while (probe.CanHit(target)) { probe.Tick(); if (probe.IsHit(target)) { ytop = Math.Max(ytop, probe.Ytop); hits++; break; } } } } return(ytop, hits); }