Cod sursa(job #1245279)
| Utilizator | Data | 18 octombrie 2014 21:11:02 | |
|---|---|---|---|
| Problema | Zombie | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#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;
}
