#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll r(ll b){
for(int i=60; i>=0; i--)if(b%(1LL<<i)==0)return (1LL<<i);
}
inline void solve(){
ll a, b, c, d, e;
cin>>a;
vector<pair<ll, ll>> v;
v.push_back({0, 0});
for(int i=0; i<a; i++){
cin>>b;
v.push_back({v.back().first+r(b), b/r(b)});
}
//for(int i=0; i<v.size(); i++)cout<<v[i].first<<" "<<v[i].second<<endl;
cin>>b;
for(int i=0; i<b; i++){
cin>>c;
auto p=*lower_bound(v.begin(), v.end(), make_pair(c, 0*1LL));
cout<<p.second<<endl;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
}
Compilation message (stderr)
Main.cpp: In function 'long long int r(long long int)':
Main.cpp:8:1: warning: control reaches end of non-void function [-Wreturn-type]
8 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |