摘要:普通模拟题
#include <iostream>
#include <string.h>
using namespace std;
const int size = 100;
int s[size+1]= {0};
int f[size+1] = {0};
int main()
{
int n;
cin >> n;
for(int index=1; index<=n; index++){
memset(s, 0, sizeof(s));
memset(f, 0, sizeof(f));
int m;
cin >> m;
int pre_num, current_num;
pre_num = 0;
for(int i=1; i<=m; i++){
int current_pos = pre_num + i-1;
cin >> current_num;
int j = 1;
for(; j<=current_num-pre_num; j++){
s[current_pos+j] = 0;
}
s[current_pos+j] = 1;
pre_num = current_num;
}
for(int j=1; j<=size; j++){
if( s[j] == 0 ){
continue;
}
int k=j-1;
for(; k>=1; k--){
if(s[k] == 0 && f[k] == 0){
f[k] = 1;
break;
}
}
int r_c = 0;
for(int o=k+1; o<=j; o++){
if(s[o] == 1){
r_c++;
}
}
cout << r_c << " ";
}
cout << endl;
}
return 0;
}