Cod sursa(job #640221)
| Utilizator | Data | 24 noiembrie 2011 22:31:08 | |
|---|---|---|---|
| Problema | Zombie | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <cstdio>
const int maxn=1000005;
long long n, k, d, a[maxn], first, sol, i;
int main()
{
freopen("zombie.in", "r", stdin);
freopen("zombie.out", "w", stdout);
scanf("%lld %lld %lld", &d, &n, &k);
for(i=1; i<=n; ++i) scanf("%lld", a+i);
first=1;
for(i=2; i<=n; ++i)
{
if(a[i]-a[first]>=d)
{
if(i-first>=k)
{
first=i;
sol+=k;
}
else
{
++first;
++sol;
}
}
}
if(i-first>=k) sol+=k;
else ++sol;
printf("%lld\n", sol);
return 0;
}
