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: Wrong Answer)

#include<stdio.h>
#include<string.h>
#define true 1
#define false 0
typedef long long ll;
void dpsx(int x,int y,int z);
void dpsy(int x,int y,int z);
void dpsz(int x,int y,int z);
void dps(int x,int y,int z);

int n;
int count;
//int x,y,z;

int funcN(int x,int y,int z){
 //int ans = x*x + y*y + z*z + x*y + x*z + y*z; 
  return x*x + y*y + z*z + x*y + x*z + y*z;
}

void dps(int x,int y,int z){
  dpsx(x+1,y,z);
  dpsy(x,y+1,z);
  dpsz(x,y,z+1);
  return;
}

void dpsx(int x,int y,int z){
//  if(n==17) printf("x,y,z:(%d,%d,%d)\n",x,y,z);
  int a = funcN(x,y,z);
  if(a == n) count++;
  if(a >= n) return;
  
  dpsx(x+1,y,z);
  dpsy(x,y+1,z);
  return;
}

void dpsy(int x,int y,int z){
//  if(n==17) printf("x,y,z:(%d,%d,%d)\n",x,y,z);
  int a = funcN(x,y,z);
  if(a == n) count++;
  if(a >= n) return;
  
  //dps(x+1,y,z);
  dpsy(x,y+1,z);
  dpsz(x,y,z+1);
  return;
}

void dpsz(int x,int y,int z){
 // if(n==17) printf("x,y,z:(%d,%d,%d)\n",x,y,z);
  
  if(funcN(x,y,z) == n) count++;
  if(funcN(x,y,z) >= n) return;
  
  dpsx(x+1,y,z);
  //dpsy(x,y+1,z);
  dpsz(x,y,z+1);
  return ;
}
int main(void){

int i,j;
//  int n;
  int a[10001];
    int c = 0;
    scanf("%d",&n);
  int loop = n+1;
  
  for(n=1;n<loop;n++){
	count = 0;
    //n=i;
    dps(1,1,1);
    printf("%d\n",count);
  }

return 0;
}