A - Number of Multiples
Editorial
/


Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
L 以上 R 以下の整数のうち、d の倍数であるようなものはいくつありますか?
制約
- 与えられる入力は全て整数
- 1 \leq L \leq R \leq 100
- 1 \leq d \leq 100
入力
入力は以下の形式で標準入力から与えられる。
L R d
出力
L 以上 R 以下の整数のうち、d の倍数であるような整数の個数を出力せよ。
入力例 1
5 10 2
出力例 1
3
- 5 以上 10 以下の整数のうち、2 の倍数であるようなものは、6,8,10 の 3 つです。
入力例 2
6 20 7
出力例 2
2
- 6 以上 20 以下の整数のうち、7 の倍数であるようなものは、7,14 の 2 つです。
入力例 3
1 100 1
出力例 3
100
Score : 100 points
Problem Statement
How many multiples of d are there among the integers between L and R (inclusive)?
Constraints
- All values in input are integers.
- 1 \leq L \leq R \leq 100
- 1 \leq d \leq 100
Input
Input is given from Standard Input in the following format:
L R d
Output
Print the number of multiples of d among the integers between L and R (inclusive).
Sample Input 1
5 10 2
Sample Output 1
3
- Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.
Sample Input 2
6 20 7
Sample Output 2
2
- Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.
Sample Input 3
1 100 1
Sample Output 3
100