Tuesday, September 20, 2016

Published September 20, 2016 by with 0 comment

Codeforces 716A Solution

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,c;
    scanf("%d%d",&n,&c);
    int ans=0;
    int d=0;
    while (n--)
    {
        int t;
        scanf("%d",&t);
        if (t-d>c) ans=1;
        else ans++;
        d=t;
    }
    printf("%d\n",ans);
    return 0;
}
      edit

0 comments:

Post a Comment