Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,i=0;
- cin>>t;
- while(t--){
- i++;
- int n,k,x,j,cnt=1;
- cin>>n>>k;
- vector<int>vt;
- for(j=0;j<n;j++){
- scanf("%d",&x);
- vt.push_back(x);
- }
- sort(vt.begin(),vt.end());
- for(j=1;j<n;j++){
- if(vt[j]-vt[j-1]>k)
- cnt++;
- }
- cout<<"Case #"<<i<<": "<<cnt<<endl;
- vt.clear();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement