Pagini recente » Cod sursa (job #1529077) | Diferente pentru problema/zombie intre reviziile 3 si 2 | Statistici Albertina Enache (enache_albertina) | Cod sursa (job #3041070) | Cod sursa (job #1245279)
#include<algorithm>
#include<fstream>
using namespace std;
ifstream f("zombie.in"); ofstream g("zombie.out");
int a[1000001];
int main()
{ int n,d,k,last,i,first=1,nr=0;
f>>d>>n>>k;
for(i=1;i<=n;i++) f>>a[i];
for(last=2;last<=n;last++)
if(a[last]-a[first]>=d)
nr+=min(last-first,k),first=last;
nr+=min(last-first,k);
g<<nr<<'\n'; return 0;
}