#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;
while (tmp%2==0) {
tmp/=2;
}
for (int i=1; i<=len/tmp; 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... |