讨论 / 这题为什么只有90分?
smx2387561 2012-05-27 06:27:00
点我顶贴 收藏 删除
哪里有问题?

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.

#1 elmo_lf@2012-05-26 06:40:00
回复 删除
猜想

目测结果 是因为 按你的打发 如果目前总共打开过10个网页 一直退到访问5个 再打开第11个网页 如果现在back 按你的应该是打第10个 而事实应是第5个

#2 zbs872867778@2012-05-27 06:27:00
回复 删除
回复 楼主smx2387561 的帖子

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.

查看更多回复
提交回复