From a1393e085e86368eeba8182b2c33b79af1405056 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 23 May 2022 22:59:09 +0800 Subject: [PATCH] B - Card Trick https://codeforces.com/contest/1681/submission/158175100 --- Codeforces/1681/B/B.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Codeforces/1681/B/B.cpp diff --git a/Codeforces/1681/B/B.cpp b/Codeforces/1681/B/B.cpp new file mode 100644 index 00000000..06b1e8f7 --- /dev/null +++ b/Codeforces/1681/B/B.cpp @@ -0,0 +1,37 @@ +#include + +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; +}