There are many ways to calculate this and more info is needed to solve the equation:
your average segment length will be =X/Y
is there a minimum length for segment 1?
Is there a specific angle that these segements must follow?
Will the segments be assembled to another component?
if so, do they need to be equally spaced?