0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 20:12:00 +00:00
OI-codes/Luogu/P2069/P2069.cpp

26 lines
490 B
C++
Raw Normal View History

2020-10-20 12:54:32 +00:00
#include <bits/stdc++.h>
using namespace std;
2021-06-30 03:21:01 +00:00
int n, m, k = 1, t;
2020-10-20 12:54:32 +00:00
vector<int> listnode;
int main() {
cin >> n >> m;
2021-06-30 03:21:01 +00:00
for (int i = 1; i <= n; i++) {
2020-10-20 12:54:32 +00:00
listnode.push_back(i);
}
for (int i = 1; i <= m; i++) {
2021-06-30 03:21:01 +00:00
t = i * i * i % 5 + 1;
2020-10-20 12:54:32 +00:00
k += t;
if (k > listnode.size()) {
k = t + 1;
}
if (i != m) {
listnode.erase(listnode.begin() + k - 1);
}
}
2021-06-30 03:21:01 +00:00
cout << listnode[k - 1] << endl;
2020-10-20 12:54:32 +00:00
return 0;
}