| Run ID | User | Problem | Result | Memory | Time | Language | Code Length | Submit Time |
| 8269940 | kingpro | 1068 | Accepted | 176K | 0MS | C++ | 293B | 2011-03-06 21:58:20 |
#include <stdio.h>
int main()
{
int n=0,l=0,s[41]={0};
scanf("%d",&n);
while(n-->0)
{
scanf("%d",&l);
for(int i=0;i<l;i++)
{
int p=2+i*2,d=p-1;
scanf("%d",&s[p]),s[p-1]=s[p]-s[p-2];
while(!s[d])d-=2;
s[d]--,printf("%d ",i-d/2+1);
}
printf("\n");
}
}
非常简单的一题,输入p序列后得到相邻p的差,w即为当前位置与向左首个不为0的差的距离
比如:4 5 6 6 6 6
得到的s:
0 4 4 1 5 1 6 0 6 0 6 0 6
w序列为:
1 => 0 3 4 1 5 1 6 0 6 0 6 0 6
1 => 0 3 4 0 5 1 6 0 6 0 6 0 6
1 => 0 3 4 0 5 0 6 0 6 0 6 0 6
4 => 0 2 4 0 5 0 6 0 6 0 6 0 6
5 => 0 1 4 0 5 0 6 0 6 0 6 0 6
6 => 0 0 4 0 5 0 6 0 6 0 6 0 6
Author: CriusWuBlog: http://kingpro.cnblogs.comContact: kingpro@live.cn
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
posted on
浙公网安备 33010602011771号