0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 14:11:58 +00:00
OI-codes/Luogu/problem/P2069/P2069.cpp
2021-06-30 11:21:01 +08:00

26 lines
490 B
C++

#include <bits/stdc++.h>
using namespace std;
int n, m, k = 1, t;
vector<int> listnode;
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
listnode.push_back(i);
}
for (int i = 1; i <= m; i++) {
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 - 1] << endl;
return 0;
}