#include <iostream>
#include <queue>
using namespace std;
struct student {
int need, pos;
};
int main()
{
int n, m;
student s;
while (cin >> n >> m) {
queue<student> q;
for (int i = 1; i <= n; ++i) {
cin >> s.need;
s.pos = i;
q.push(s);
}
while (!q.empty()) {
if (q.size() == 1) {
cout << q.front().pos << endl;
break;
}
if (q.front().need > m) {
student tmp = q.front();
q.pop();
tmp.need -= m;
q.push(tmp);
}
else {
q.pop();
}
}
}
return 0;
}
Codeforces Round #257 (Div. 2)1A Jzzhu and Children
最新推荐文章于 2023-02-04 15:35:33 发布