Pagini recente » Cod sursa (job #2145125) | Cod sursa (job #2602237) | Cod sursa (job #1687694) | Cod sursa (job #635322) | Cod sursa (job #2641224)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define Nmax 20005
ifstream fin ("zombie.in");
ofstream fout ("zombie.out");
#define cin fin
#define cout fout
/*
ifstream fin("test.in");
#define cin fin
*/
void solve() {
ll d, m, k;
ll sol = 0;
cin >> d >> m >> k;
ll first; cin >> first;
ll contor = 1;
for(ll i = 2; i <= m; i++) {
int second; cin >> second;
if(second - first >= d - 1) { /// daca depasesc momentu de timp dau clear
sol += min(contor, k);
contor = 1;
first = second;
} else {
contor++; /// cresc momentul de timp
}
}
sol += min(contor, k); /// adaug ce a mai ramas
cout << sol;
}
int main() {
ios_base::sync_with_stdio(0);
cin .tie(0);
cout.tie(0);
int testCases = 1;
//cin >> testCases;
while(testCases--) {
solve();
}
}