Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int t;
- cin >> t;
- while(t--){
- int n,r;
- cin >> n >> r;
- int a[n];
- for(int i = 0; i < n; i++ ){
- cin >> a[i];
- }
- sort(a,a+n,greater<int>());
- int cnt = 0;
- for(int i = 0; i <n; i++){
- if(i > 0 && a[i] == a[i-1]);
- else if(a[i] - cnt*r <= 0);
- else{
- cnt++;
- }
- }
- cout << cnt << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement