CF1066A Vova and Train

题目描述

## 题意描述: $Vova$ 先生要乘火车去旅行,火车一开始位于 $1$ 点,以每秒 $1$ 个单位的速度向前行驶,最终到达 $L$ 处。(也就是说,火车在第 $1min$ 时在 $1$ 处,在 $2min$ 时在 $2$ 处) 铁路沿线挂着一些灯笼,这些灯笼的位于坐标是 $v$ 的倍数的地方,第一个灯笼位于 $v$ 处。 同时,有另一列火车停在另一侧的轨道上,这列火车的左右端点位于 $l$ 和 $r$ 处。 当 $Vova$ 先生经过一个地点,这个地点既有灯笼,又没有被另一列火车挡住时,我们称 $Vova$ 先生可以看到灯笼,现在,我们需要你求出一路上 $Vova$ 先生能看到几盏灯笼。本题有多组数据。

输入格式

第一行:一个整数 $t(1 \le t \le 10^4)$,表示数据组数。 下面 $t$ 行,每行 $4$ 个整数 $L_i$,$v_i$,$l_i$,$r_i$, $(1 \le L,v \le 10^9,1 \le l \le r \le L)$,各个字母的含义上文已经给出。

输出格式

$t$ 行,每 $1$ 个整数,表示 $Vova$ 先生能看到的灯笼数。

说明/提示

For the first example query, the answer is $ 3 $ . There are lanterns at positions $ 2 $ , $ 4 $ , $ 6 $ , $ 8 $ and $ 10 $ , but Vova didn't see the lanterns at positions $ 4 $ and $ 6 $ because of the standing train. For the second example query, the answer is $ 0 $ because the only lantern is at the point $ 51 $ and there is also a standing train at this point. For the third example query, the answer is $ 1134 $ because there are $ 1234 $ lanterns, but Vova didn't see the lanterns from the position $ 100 $ to the position $ 199 $ inclusive. For the fourth example query, the answer is $ 0 $ because the standing train covers the whole path.