提交后是九十分、、、、
#include"iostream"
using namespace std;
struct {
int left;
int seat[5];
} a[21];
int b[105];
int c[105][5];
int main() {
int num = 1;
for (int i = 0; i < 20; i++) {
a[i].left = 5;
for (int j = 0; j < 5; j++) {
a[i].seat[j] = num;
num++;
}
}
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> b[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 20; j++) {
if (b[i] <= a[j].left) {//这一排可以购买
for (int k = 0; k < b[i]; k++) {
for (int l = 0; l < 5; l++) {
if (a[j].seat[l] != 0) {
c[i][k] = a[j].seat[l];
a[j].left--;
a[j].seat[l] = 0;
break;
}
}
}
break;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < b[i]; j++) {
cout << c[i][j];
if (j != b[i])
cout << " ";
}
if (i != n-1)
cout << "\n";
}
return 0;
}