mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-18 04:11:59 +00:00
P2069 松鼠吃果子 [90' Code]
This commit is contained in:
parent
81b363881a
commit
332460ff29
26
problem/P2069/P2069.cpp
Normal file
26
problem/P2069/P2069.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
vector<int> 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user