/*
Time:2019.12.4
Author: Goven
type:模拟
ref:
注:分配r的时候是从编号1开始的,不是r的排序名次
*/
#include<iostream>
#include<algorithm>
using namespace std;
int r[1005];
int main()
{
int n, t;
cin >> n >> t;
for (int i = 1; i <= n; i++) {
cin >> r[i];
}
if (n == 1) {//err1:特殊情况
while(t > 0) {
cout << 1 << endl;
t--;
}
return 0;
}
while(t--) {
int idx = 1, tp1, tp2;
for (int i = 1; i <= n; i++) {
if (r[i] > r[idx]) idx = i;
}
cout << idx << endl;
tp1 = r[idx] / (n - 1);
tp2 = r[idx] % (n - 1);
for (int i = 1; i <= tp2; i++) ++r[i];
if (idx <= tp2) ++r[tp2 + 1];
//tp1 = r[idx] / (n - 1);//err2:r[idx]变了
for (int i = 1; i <= n; i++) r[i] += tp1;
r[idx] = 0;
}
return 0;
}
网友评论