求大神指教

var

n,i,j,k,p,t:longint;

a,b:packed array[0..1500]of longint;

begin

   readln(n);

   for i:=1 to n do

    begin

    read(a[i]);

    b[i]:=a[i]-a;

    end;

   for i:=1 to n do

     begin

     p:=i;

     while b[p]=0 do dec(p);

     write(a[i]-a[p-1]-b[p]+1,' ');

     dec(b[p]);

     end;

end.

#include

using namespace std;

int main()

{

long n,t,a[1502],b[1502],c[1052];

cin >> n;

for (int i = 1; i > a[i];

c[i] = a[i] - a[i - 1];

t = i;

while (c[t] == 0)

--t;

b[i] =a[i] - a[t-1] -c[t] + 1;

--c[t];

}

for (int i = 1; i

0 条评论

目前还没有评论...

信息

ID
1062
难度
4
分类
数据结构 | 点击显示
标签
递交数
3510
已通过
1400
通过率
40%
被复制
11
上传者