mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 23:16:27 +00:00
38 lines
504 B
C++
38 lines
504 B
C++
#include <iostream>
|
|
|
|
using std::cin;
|
|
using std::cout;
|
|
const char endl = '\n';
|
|
|
|
const int N = 2e5 + 5;
|
|
|
|
int t, n, m, a[N];
|
|
|
|
int main() {
|
|
std::ios::sync_with_stdio(false);
|
|
|
|
cin >> t;
|
|
|
|
while (t--) {
|
|
long long t = 0;
|
|
|
|
cin >> n;
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i];
|
|
}
|
|
|
|
cin >> m;
|
|
|
|
for (int i = 1, x; i <= m; i++) {
|
|
cin >> x;
|
|
|
|
t += x;
|
|
}
|
|
|
|
cout << a[t % n + 1] << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|