|
|
back to boardCould you tell me why i got Wrong. Posted by Cancer 20 Nov 2002 23:21 Const Maxa=1000; Maxn=100000; Var ch:char; From:array[0..Maxn div 2] of longint; a:array[1..Maxa] of longint; num:array[1..Maxn] of longint; i,x,p,q,n,y,t,j:longint; Procedure Push; Begin inc(p); num[p]:=y; t:=p div 2; if odd(p) then from[t]:=from[t]+a[x] else from[t]:=from[t]+a[x]*Maxn; a[x]:=p; ENd; Procedure POP; Begin writeln(num[a[x]]); t:=a[x] div 2; if odd(a[x]) then begin a[x]:=from[t] mod Maxn; end else begin a[x]:=from[t] div Maxn; end; End; Begin readln(n); fillchar(a,sizeof(a),0); fillchar(num,sizeof(num),0); p:=0; q:=0; repeat inc(q); while not(ch in ['U','O'] )do read(ch); if ch='U' then begin read(ch); read(ch); read(x,y); PUSH; end else if ch='O' then begin read(ch); read(x); POP; end; readln;
until q=n; End. |
|
|