private long SolveCycleFirstMethod(Cycle cycle) { return(cycle.SumWeight + (cycle.Length - 2) * cycle.MinWeight); }
private long SolveCycleSecondMethod(Cycle cycle) { return(cycle.SumWeight + cycle.MinWeight + (cycle.Length + 1) * MinWeight); }
private bool IsSecondMethodBetter(Cycle cycle) { return(((float)(cycle.Length - 3)) / (cycle.Length + 1) * cycle.MinWeight > MinWeight); //sum(C) + (|C|-2) * min(C) >? sum(C) + min(C) + (|C|+1) * min }