Pagini recente » Borderou de evaluare (job #1524773) | Luam-ai sa ma iei | Diferente pentru utilizator/lex intre reviziile 3 si 2 | Cod sursa (job #661311) | Cod sursa (job #1529110)
#include <fstream>
using namespace std;
int main()
{
ifstream fin ("zombie.in");
ofstream fout ("zombie.out");
ios::sync_with_stdio(false);
int d, n, k, first, zombie=1, sol=0, i, x;
fin >> d >> n >> k >> first;
for(i=2; i<=n; i++)
{
fin >> x;
if(x-first <= d) zombie++;
else
{
first=x;
if(k > zombie) sol=sol+zombie;
else sol=sol+k;
}
}
if(k > zombie) sol=sol+zombie;
else sol=sol+k;
fout << sol;
return 0;
}