|
|
вернуться в форумMy program is said to use 753KB, but I don't think so. Послано Koala 29 авг 2003 13:51 program p1220; const maxn=100000; m=1000; type indextype=record ind1,ind2,ind3:byte; end; var value:array [1..maxn] of longint; pre:array [1..maxn] of indextype; top:array [1..m] of indextype; ppp,n,pp,i,k,x:longint; st:string; ch:char; begin readln(ppp); n:=0; fillchar(top,sizeof(top),0); for pp:=1 to ppp do begin st:=''; read(ch); while ch<>' ' do begin st:=st+ch; read(ch); end; if st='PUSH' then begin readln(i,x); inc(n); value[n]:=x; pre[n]:=top[i]; k:=n; top[i].ind3:=k mod 256; k:=k div 256; top[i].ind2:=k mod 256; k:=k div 256; top[i].ind1:=k; end else begin readln(i); x:=top[i].ind1*256*256+top[i].ind2*256+top[i].ind3; writeln(value[x]); top[i]:=pre[x]; end; end; end. |
|
|