Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <ext/rope>
  3.  
  4. using namespace std;
  5. using namespace __gnu_cxx;
  6.  
  7. random_device rd;
  8. mt19937 rnd(rd());
  9. #define pt pair<int, int>
  10. #define x first
  11. #define y second
  12. #define what_is(x) cerr << #x << " is " << x << endl;
  13. #define ok cerr << "ok" << endl;
  14. #define endl '\n'
  15. #define int long long
  16. #define ld long double
  17.  
  18. signed main()
  19. {
  20. cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
  21.  
  22. int q;
  23. cin >> q;
  24. while (q--)
  25. {
  26. int n, x, mx = 0;
  27. cin >> n >> x;
  28. set<int> st;
  29. for (int i = 0, temp; i < n; ++i)
  30. {
  31. cin >> temp;
  32. mx = max(mx, temp);
  33. st.insert(temp);
  34. }
  35.  
  36. int cnt = abs(x - mx) / mx;
  37. x -= cnt * mx;
  38. if (st.count(x))
  39. ++cnt;
  40. else
  41. cnt += 2;
  42. cout << cnt << endl;
  43. }
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement