Pagini recente » Cod sursa (job #2455222) | Cod sursa (job #1480817) | Cod sursa (job #1457451) | Cod sursa (job #2199925) | Cod sursa (job #9679)
Cod sursa(job #9679)
# include <stdio.h>
# define input "secv5.in"
# define output "secv5.out"
# define max 4001001
long a,b,n,i,j,st,dist,rez,gasit,val;
long long unsigned x[max];
int main()
{
freopen(input,"r",stdin);
freopen(output,"w",stdout);
scanf("%ld%ld%ld",&n,&a,&b);
st = 1;
for(i = 1;i<=n;i++)
{
scanf("%ld",&x[i]);
j=i-1;
dist=1;
while(j>=st && dist<=b)
{
gasit = 0;
for(val=j+1;val<=i;val++)
{
if(x[j] == x[val])
{
gasit =1;
break;
}
}
if(!gasit)
dist++;
j--;
if(dist >= a && dist <= b)
rez++;
}
st = j+1;
}
printf("%ld",rez);
return 0;
}