Cod sursa(job #2782110)
Utilizator | Data | 11 octombrie 2021 17:39:49 | |
---|---|---|---|
Problema | Zombie | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream cin("zombie.in");
ofstream cout("zombie.out");
int n,d,k,nr,cnt=0,s=0,a;
cin>>n>>d>>k;
nr=d;
for(int i=0;i<n;i++)
{
cin>>a;
if(a<=nr)
cnt++;
else
{
if(cnt>k)
s+=k;
else
s+=cnt;
cnt=0;
nr+=d;
}
}
if(cnt>k)
s+=k;
else
s+=cnt;
cout<<s;
return 0;
}