Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll n, m;
- cin >> n >> m;
- vector<ll> a(n);
- for (int i = 0; i < n; ++i) {
- cin >> a[i];
- }
- while (m--) {
- ll x;
- cin >> x;
- ll ans = 0;
- for (int i = 0; i < n; ++i) {
- ans += x / a[i] + (x % a[i] != 0);
- x = x / a[i] + (x % a[i] != 0);
- }
- cout << ans << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement