P17507 [Beginner Contest #52] Mid-Autumn Bamboo Lanterns
Description
The Mid-Autumn Festival is approaching, and the town of Luogu is preparing a lively Mid-Autumn lantern fair. To make the frames for hanging lanterns, the craftsmen of Luogu need to cut a number of bamboo pieces of length exactly $z$ from bamboos.
There is a row of bamboos in the bamboo forest, whose lengths are all integers and are, in order, $x,x+1,x+2,\dots,y$. From each bamboo, a craftsman can cut as many pieces of length exactly $z$ as possible. If the remaining part of a bamboo is shorter than $z$, it cannot be used further; the leftover parts of different bamboos cannot be joined together either.
Calculate the total number of bamboo pieces of length $z$ that can be cut from this row of bamboos.
Input Format
The input contains one line with three integers $x,y,z$, the length of the shortest bamboo, the length of the longest bamboo, and the required length of each piece, respectively.
Output Format
Output a single integer, the total number of pieces of length $z$ that can be cut from all the bamboos.
Explanation/Hint
### Sample 1 Explanation
The lengths of the bamboos are $3,4,5,6,7$ in order, from which $1,2,2,3,3$ pieces can be cut respectively, for a total of $11$ pieces.
### Sample 2 Explanation
All bamboos are shorter than $10$, so no piece of length $10$ can be cut.
### Constraints
There are $20$ test points in this problem.
- For test points $1\sim 4$, $x=y$;
- For test points $5\sim 8$, $y-x\leq 10$;
- For test points $9\sim 16$, $x,y,z\leq 1000$;
- For all test points, $1\leq x\leq y\leq 2\times 10^5$ and $1\leq z\leq 2\times 10^5$.
Translated by QwenWork