Zinak

Untitled

Oct 8th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6.     ll q,n,r,i,x,cnt,mx,c1;
  7.     set<ll>s;
  8.     cin>>q;
  9.     while(q--){
  10.         cnt=0;
  11.         cin>>n>>r;
  12.         for(i=0;i<n;i++)cin>>x,s.insert(x);
  13.         cnt=1;
  14.         for(auto j=s.end();j!=s.begin();j--){
  15.             c1=cnt;
  16.             x=*j;
  17.             while(c1--)x-=r;
  18.             if(x>0)cnt++;
  19.             else
  20.             break;
  21.         }
  22.         cout<<cnt<<endl;
  23.         s.clear();
  24.     }
  25.     return 0;
  26. }
Add Comment
Please, Sign In to add comment