var a:array[0..10000] of string;
i,j,k,m,n:longint;
s,x:string;
begin
readln(s);
a[1]:='http://www.acm.org/';
i:=1;
while s<>'QUIT' do
begin
if s[1]='V' then
begin
delete(s,1,6);
inc(i);
a[i]:=s;
writeln(a[i]);
end else
if s='BACK' then
begin
dec(i);
if i=0 then begin writeln('Ignored'); inc(i); end else writeln(a[i]);
end else
if s='FORWARD' then
begin
inc(i);
if a[i]='' then begin writeln('Ignored'); dec(i) end else writeln(a[i]);
end;
readln(s);
end;
end.
目测结果 是因为 按你的打发 如果目前总共打开过10个网页 一直退到访问5个 再打开第11个网页 如果现在back 按你的应该是打第10个 而事实应是第5个
var a:array[0..10000] of string;
i:longint;
s:string;
begin
readln(s);
a[1]:='http://www.acm.org/';
i:=1;
while s<>'QUIT' do
begin
if s[1]='V' then
begin
delete(s,1,6);
inc(i);
a[i]:=s;
writeln(a[i]);
end else
if s='BACK' then
begin
dec(i);
if i=0 then begin writeln('Ignored'); inc(i); end else writeln(a[i]);
end else
if s='FORWARD' then
begin
inc(i);
if a[i]='' then begin writeln('Ignored'); dec(i) end else writeln(a[i]);
end;
readln(s);
end;
end.