From 332460ff296c775de48933a35d8c79500dc82928 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Tue, 20 Oct 2020 20:54:32 +0800 Subject: [PATCH] =?UTF-8?q?P2069=20=20=E6=9D=BE=E9=BC=A0=E5=90=83=E6=9E=9C?= =?UTF-8?q?=E5=AD=90=20[90'=20Code]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problem/P2069/P2069.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 problem/P2069/P2069.cpp diff --git a/problem/P2069/P2069.cpp b/problem/P2069/P2069.cpp new file mode 100644 index 00000000..850ed368 --- /dev/null +++ b/problem/P2069/P2069.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +vector listnode; + +int main() { + int n, m, k = 1; + listnode.clear(); + cin >> n >> m; + for (int i = 0; i < n; i++) { + listnode.push_back(i); + } + for (int i = 1; i <= m; i++) { + int t = i * i * i % 5 + 1; + k += t; + if (k > listnode.size()) { + k = t + 1; + } + if (i != m) { + listnode.erase(listnode.begin() + k - 1); + } + } + cout << listnode[k] << endl; + return 0; +}