Pagini recente » Cod sursa (job #635878) | Cod sursa (job #2716182) | Cod sursa (job #1657194) | Cod sursa (job #2366896) | Cod sursa (job #1650124)
#include <fstream>
using namespace std;
ifstream f("zombie.in");
ofstream g("zombie.out");
unsigned long long N, D, K, activeZ, st, sol, x;
int main()
{
f >> D >> N >> K;
for(int i = 1; i <= N; i++){
f >> x;
if(x - st <= D - 1){
activeZ++;
continue;
}
sol += activeZ > K ? K : activeZ;
activeZ = 1;
st = x;
}
sol += activeZ > K ? K : activeZ;
g << sol;
return 0;
}