|
|
back to boardsos!!!why Compilation error??? Posted by dearjy 18 Sep 2006 11:09 var n,l,k1,i,k2 :longint; f :array[0..66666]of longint; k :array[0..66666,1..2]of longint; procedure qsort(a,b:longint); var i,j :longint; mid :array[1..2]of longint; begin i:=a;j:=b;mid:=k[i]; while i<j do begin while (k[j,1]>mid[1])and(j>i) do dec(j); if j>i then begin k[i]:=k[j]; inc(i); end; while (k[i,1]<mid[1])and(j>i) do inc(i); if j>i then begin k[j]:=k[i]; dec(j); end; end; k[i]:=mid; if i-1>a then qsort(a,i-1); if i+1<b then qsort(i+1,b); end; begin read(n); for i:=1 to n do begin read(k[i,1]); k[i,2]:=i; end; qsort(1,n); l:=1;k1:=1;k2:=0; fillchar(f,sizeof(f),0); while l<=n do begin k1:=k1+k2; inc(k2); while (k1>=k[l,1])and(l<=n) do if k1=k[l,1] then begin f[k[l,2]]:=1;inc(l);end else while (k1>k[l,1])and(l<=n)do inc(l); end; for i:=1 to n do if i=n then write(f[i]) else write(f[i],' '); end. Re: sos!!!why Compilation error??? Posted by AlexF 18 Sep 2006 16:46 mid:=k[i]; in QSort! Re: sos!!!why Compilation error??? Posted by hx 10 Feb 2009 19:26 In strings 11 and 27 you don`t write two index of array "k". |
|
|