Last active
July 24, 2017 21:42
-
-
Save MohamedTaha98/3c38e26cb883f5633eda3ba6bdff979b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
long long n, c, words = 1; | |
cin >> n >> c; | |
long ar[n]; | |
for (int i = 0; i < n; i++) | |
cin >> ar[i]; | |
for (int i = 0; i < n - 1; i++) { | |
if (ar[i + 1] - ar[i] <= c) | |
words++; | |
else | |
words = 1; | |
} | |
cout << words << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment