Count Multiples In Range

Count Multiples In Range

Medium Computer Mathematics Integers & Divisibility 38 views
Explanation Complexity

Problem Statement

Given L R k, count integers in [L,R] divisible by k.

Input Format

Three integers L R k.

Output Format

One integer count.

Example

1 10 3
3

Constraints

1

Input / Output Format

Input Format
Three integers L R k.
Output Format
One integer count.
Constraints
1

Examples

Input:
1 10 3
Output:
3

Example Solution (Public)

Computer Mathematics
Count = floor(R/k) - floor((L-1)/k). Use integer division.

Official Solution Code

Count = floor(R/k) - floor((L-1)/k). Use integer division.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.