Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int t,n,k,i,j,count=1,a[1000],b,c,d;
- cin>>t;
- for(i=1;i<=t;i++)
- {
- cin>>n>>k;
- count=1;
- for(j=0;j<n;j++)
- cin>>a[j];
- sort(a,a+n);
- for(j=1;j<n;j++)
- {
- b=a[j]-a[j-1];
- if(b>k)
- count++;
- }
- cout<<"Case #"<<i<<": "<<count<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement