#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector <int> castella;
for (int i=0; i<n; i++) {
int len;
cin >> len;
if (len%2!=0) castella.push_back(len);
else {
int tmp=len;
int cnt;
while (tmp%2==0) {
tmp/=2;
cnt = len/tmp;
}
for (int i=1; i<=cnt; i++) {
castella.push_back(tmp);
}
}
}
int Q;
cin >> Q;
for (int i=0; i<Q; i++) {
int search;
cin >> search;
cout << castella[search-1] << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |