Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. ll n, m;
  2. cin >> n >> m;
  3. vector<ll> a(n);
  4. for (int i = 0; i < n; ++i) {
  5. cin >> a[i];
  6. }
  7. while (m--) {
  8. ll x;
  9. cin >> x;
  10. ll ans = 0;
  11. for (int i = 0; i < n; ++i) {
  12. ans += x / a[i] + (x % a[i] != 0);
  13. x = x / a[i] + (x % a[i] != 0);
  14. }
  15. cout << ans << "\n";
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement