1417A - Copy Paste
28 Jan 2021 — Tags: None
Click to show code.
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
template <typename InputIterator,
typename T = typename iterator_traits<InputIterator>::value_type>
void read_n(InputIterator it, int n)
{
copy_n(istream_iterator<T>(cin), n, it);
}
template <typename InputIterator,
typename T = typename iterator_traits<InputIterator>::value_type>
void write(InputIterator first, InputIterator last, const char *delim = "\n")
{
copy(first, last, ostream_iterator<T>(cout, delim));
}
int main(void)
{
int t;
cin >> t;
while (t--)
{
int n, k;
cin >> n >> k;
vi a(n);
read_n(a.begin(), n);
sort(a.begin(), a.end());
int minv = a[0];
ll ans =
accumulate(a.begin() + 1, a.end(), 0LL, [minv, k](ll acc, int ai) {
return acc + (k - ai) / minv;
});
cout << ans << endl;
}
return 0;
}