Problem Link: https://www.codechef.com/ZCOPRAC/problems/ZCO15002
My logic is correct but… no any test case runs successfully!
Source Code:
#include <stdio.h>
int main(void) {
long long int n,k,a[4000],temp=0,i;
scanf("%lld%lld",&n,&k);
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
for(i=0;i<n-1;i++)
{
if(abs(a[i]-a[i+1])>=k)
{
temp++;
}
}
printf("%lld",temp);
return 0;
}