Untitled
unknown
c_cpp
20 days ago
696 B
7
Indexable
#include <bits/stdc++.h> using namespace std; void MO3TAZOLEQ() { #ifdef MOATAZOLEQ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } #define ll long long void solve() { int n, r; cin >> n >> r; set<int> st; for (int i = 0; i < n; ++i) { int x; cin >> x; st.insert(x); } int ans = 0; for (auto it = st.rbegin() ; it != st.rend(); ++it) { if (*it - ans * r <= 0) break; ++ans; } cout << ans << '\n'; } int main() { MO3TAZOLEQ(); ios_base::sync_with_stdio(false); cin.tie(nullptr); int t = 1; cin >> t; while (t--) { solve(); } return 0; }
Editor is loading...
Leave a Comment