Advertisement
Zinak

Untitled

Oct 8th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 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,cnt,mx,c1,x;
  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.                 while(c1--)*j-=r;
  17.                 if(*j>0)cnt++;
  18.                 else
  19.                 break;
  20.             }
  21.  
  22.         }
  23.         cout<<cnt<<endl;
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement