杰洛 |
2006-05-01 19:50 |
4.program Programg4; var m,n,i,j:integer; p,w,a,b:array[0..19] of integer; begin read(n); m:= 0; for i:= 0 to n-1 do begin read (p); b :=1; end; for i := 0 to n-1 do begin if (i>0) then a[m]:= p-p[i-1] else a[m]:= p; m:= m+1: while ((m>1) and (a[rn-1]=0)) do begin m ;= m-1; b[m] := l; end; if (m>0) then w:=b[m-1] else w:=b[0]; a[m-1] := a[m-1]-1; for j := 0 to m-1 do b[j] ;= b[j]+1; while ((m>1) and (a[m-1]=0)) do begin m := m-1; b[m] :=1; end; end; for i := 0 to n-1 do begin write(w); write(' '); end; writeln(' '); end. 输入:9 4 6 6 6 6 8 9 9 9 输出:
帮忙算算 P.S 我不懂,我是帮人问的 |
|