#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int a[30],b[100];
int main()
{
int n;
while(~scanf("%d",&n)&&n)
{
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
int m=a[n-1];
int j=1, t=0;
for(int i=0;i<n;i++)
{
if(a[i])
{
int q=a[i]-a[i-1];
while(q--)
b[t++]=j;
}
j++;
}
for(int i=0;i<m;i++)
{
if(b[i]){
if(!i)
printf("%d",b[i]);
else
{
printf(" %d",b[i]);
}
}
}
printf("\n");
}
return 0;
}
一开始我的做法是边输入边输出
但是
这样的话
第三组数据
就会末尾多空格
所以应该
两组数组
一组存储
一组输出