0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 23:08:47 +00:00
OI-codes/Luogu/P2069/P2069.cpp

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;
}