0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-11 22:06:27 +00:00

B - Card Trick

https://codeforces.com/contest/1681/submission/158175100
This commit is contained in:
Baoshuo Ren 2022-05-23 22:59:09 +08:00
parent a92e2474ba
commit a1393e085e
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

37
Codeforces/1681/B/B.cpp Normal file
View File

@ -0,0 +1,37 @@
#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;
}