Problem:
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

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

#include<bits/stdc++.h>
#define fi                first
#define se                 second
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<double,double> &a,
               const pair<double,double> &b)
{
    if(a.fi==b.fi)
    {
    return (a.se >b.se);
    }
    else
        return (a.fi<b.fi);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
ll sumofdigit(ll n)
{
    ll c=0,d=0,sum=0,i;
    while(n>0)
    {
        c=n%10;
        sum+=c;
        n/=10;
    }
    return sum;
}
ll fact(ll n)
{
    ll c=1;
    for(ll i=1;i<=n;i++)
    {
        c*=i;
    }
    return c;
}
ll ks(vector<ll> &a,ll k,ll n)
{
     ll dp[n+1][k+1];
    for(ll i=0;i<n+1;i++)
    {
        for(ll j=0;j<k+1;j++)
        {
            if(i==0||j==0)
                dp[i][j]=0;
            else
            {
                if(a[i-1]>j)
                {
                    dp[i][j]=dp[i-1][j];
                }
                else
                {
                    if(dp[i][j-a[i-1]]!=0||j==a[i-1])
                    dp[i][j]=max(dp[i-1][j],(1+dp[i][j-a[i-1]]));
                    else
                    dp[i][j]=dp[i-1][j];
                }
            }
        }
    }
    return dp[n][k];
}
int main()
{
 fast;
     int t=1;
     //cin>>t;
     while(t--)
     {
        ll k=0,n,i=0,j=0,c=0,d=0,e=0,f=0,sum=0,g=0,h=0,maxi=0;
         cin>>n>>k>>c;
         for(i=n;i<=k;i++)
         {
             if(i%c==0)
             {
                 sum++;
             }
         }
         cout<<sum<<endl;

     }
}