Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/rope>
- using namespace std;
- using namespace __gnu_cxx;
- random_device rd;
- mt19937 rnd(rd());
- #define pt pair<int, int>
- #define x first
- #define y second
- #define what_is(x) cerr << #x << " is " << x << endl;
- #define ok cerr << "ok" << endl;
- #define endl '\n'
- #define int long long
- #define ld long double
- signed main()
- {
- cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
- int q;
- cin >> q;
- while (q--)
- {
- int n, x, mx = 0;
- cin >> n >> x;
- set<int> st;
- for (int i = 0, temp; i < n; ++i)
- {
- cin >> temp;
- mx = max(mx, temp);
- st.insert(temp);
- }
- int cnt = abs(x - mx) / mx;
- x -= cnt * mx;
- if (st.count(x))
- ++cnt;
- else
- cnt += 2;
- cout << cnt << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement