@inkysakura
2017-04-26T22:31:14.000000Z
字数 322
阅读 1295
CODE
#include <iostream>
#include <algorithm>
using namespace std;
int n,w;
int y[50005];
int ans=0;
int nCase,tp;
int main()
{
int t;
cin >> t;
while(t--)
{
ans=0;
cin >> n >> w;
for(int i=0;i<n;i++)
cin >>tp>>y[i];
sort(y,y+n);
int cur=-10005-1e9;
for(int i=0;i<n;i++)
{
if(cur+w<y[i])
{
ans++;
cur=y[i];
}
}
cout << "Case "<<++nCase<<": "<<ans<<endl;
}
return 0;
}