poj1068

简单模拟

View Code
#include <iostream>
using namespace std;

const    int        maxn=22;

int        n,N,p[maxn],le[maxn];
bool    first;

void init()
{
    int        i,j;

    cin>>n;
    first=true;
    for (i=1;i<=n;i++)
    {
        cin>>p[i];
        le[i]=p[i]-p[i-1];
        j=i;
        while (!le[j])
            j--;
        le[j]--;
        if (!first)
            cout<<" ";
        else
            first=false;
        cout<<i-j+1;
    }
}

int main()
{
//    freopen("t.txt","r",stdin);
    cin>>N;
    while (N--)
    {
        init();
        cout<<endl;
    }
    return 0;
}

 

posted @ 2012-12-25 16:02  金海峰  阅读(426)  评论(0编辑  收藏  举报