Several points are marked on a line, and all possible segments are made between pairs of these points. One point lies on 80 segments, another 90...... One of the points lies on 80 of these segments; another point lies on
90 segments. How many points were marked on the line?
Answer Choices are 20, 22, 80, and 90
My work:

 A: Assuming being the endpoint (that is, one of the pre-selcted set of points) means to belong to a segment, there are two cases for any point: either it is an endpoint or not.
Suppose there are $N > 0$ points chosen.
If the point $P$ is not an endpoint and there are $m$ points to the left, then there are $N-m$ points to the right and $P$ belongs to $m\cdot (N-m)$ segments.
OTOH if $P$ is an endpoint and there are $m$ points to the left, then there are $(N-m-1$) points to the right and $P$ belong to $m\cdot (N-m-1)$ segments as an internal point and to $N-1$ segments as an endpoint (one to each of remaining $N-1$ points).
So, you need to find such number $N$, that there exist numbers $m_{80}$ and $m_{90}$ such that
$$m_{80}(N-m_{80}) = 80 \quad \text{or} \quad m_{80}(N-1-m_{80})+(N-1) = 80$$
and
$$m_{90}(N-m_{90}) = 90 \quad \text{or} \quad m_{90}(N-1-m_{90})+(N-1) = 90$$
But I have no idea how to do that efficiently. :(
A: The result suggests that here an endpoint is not counted as lying on a segment.
When we assume this to be the case, we find that each point will lie on $ab$ segments, where there are $a$ points to one side and $b$ points to the other - in other words, the total number of points is $a+b+1$.
Looking then at the factors of $80$ and $90$, we can see that both can be produced by a partition of $21$: $80= 16\times 5$ and $90= 15\times 6$. This implies that the answer sought is $22$.

By contrast, if we assume that the endpoints do indeed lie on segments, each point lies on $ab+a+b = (a+1)(b+1)-1$ segments and we would be looking for suitable ways to factor $81$ and $91$, but this doesn't give an answer.
