hallo, I just registrated and saw this interesting problem here http://www.codechef.com/problems/DIVQUERY/ ,I make some code I and I think it is fine ,when I type the same input like in the problem the output is the same ,but It is giving me runtime error.Here is the code in C :
#include <stdio.h>
#include <stdlib.h>
int main()
{
int N;//sequence of integers
int Q;//how many quiries
int L,R,K;//L-left,R-right,K-number to be divisible
printf(“Enter the number of numbers and the number of quiries\n”);
scanf("%d",&N);
scanf("%d",&Q);
int i;int count=0;int check=0;
int numbers[N];int otgovori[100];int j;
printf(“Now enter the numbers\n”);
for(i=0;i<N;i++)
{
scanf("%i",&numbers[i]);
}
printf(“Now enter L ,R and K\n”);
for(i=0;i<Q;i++){
scanf("%d",&L);
scanf("%d",&R);
scanf("%d",&K);
for(j=L-1;j<R;j++)
{
if(numbers[j]%K==0)
{
check++;
}
}
otgovori[count]=check;
count++;
check=0;
}
for(j=0;j<Q;j++)
{
printf("%i\n",otgovori[j]);
}
}