Multiples in a Range
How many multiples of D lie in [L, R]?
Input: one line with three integers L, R, D.
Output: ⌊R/D⌋ − ⌊(L−1)/D⌋.
Constraints:
- 1 ≤ L ≤ R ≤ 1018
- 1 ≤ D ≤ 1018
Sample Tests
Input 1
6 20 5
Output 1
3
Input 2
1 10 1
Output 2
10
Discussion (opens after you solve — no spoilers before)
No comments yet.