题目链接:http://codeforces.com/problemset/problem/716/A

 

题目大意:

把题读懂就是水题了。题目是说打下下一个字母的时候,如果和之前字母打下的时间不超过k的话,则保留前面的继续打,如果超过了,则前面的字母全部消失,只留下这一个字母。

 

哭泣。一直在读错题意!

 

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <stdlib.h>
 4 #include <string>
 5 #include <string.h>
 6 #include <set>
 7 #include <queue>
 8 #include <stdbool.h>
 9 #include <map>
10 
11 using namespace std;
12 const int MAXN=100005;
13 
14 int a[MAXN];
15 
16 int main()
17 {
18 #ifndef ONLINE_JUDGE
19     freopen("../in.txt","r",stdin);
20 #endif
21     int n,c;
22     scanf("%d%d",&n,&c);
23     for (int i=0;i<n;i++)
24         cin >> a[i];
25     int cnt = 1;
26     for (int i=1;i<n;i++) {
27         if (a[i]-a[i-1]<=c)
28             cnt++;
29         else
30             cnt = 1;
31     }
32     printf("%d\n",cnt);
33     return 0;
34 }