过不了QAQ。。

var st:string;
sz:array[1..128] of real;
zf:boolean;
i,j,k,x:integer;
y:real;
begin

j:=0;
k:=1;
zf:=false;

read(st);

for i:=1 to length(st) do

begin

if st[i] in ['*','+'] then

begin

if zf then

begin

val(copy(st,k,i-k),y,x);

sz[j]:=sz[j] * y;

end

else
begin

inc(j);
val(copy(st,k,i-k),y,x);

sz[j]:=y;

end;

k:=i+1;

if st[i]='*' then zf:=true
else zf:=false;
end;

if i=length(st) then if zf then
begin
val(copy(st,k,i-k+1),y,x);
sz[j]:=sz[j] * y;

end

else

begin

inc(j);

val(copy(st,k,i-k+1),y,x);

sz[j]:=y;

end;

end;
y:=0;

for i:=1 to j do

y:=y + sz[i];

str(y:0:0,st);

if length(st)<=4 then write(st)

else

begin

val(copy(st,length(st)-3,4),y,x);

write(y:0:0);

end;
end.

样例都对啊!!!
什么情况?而且还是全部WA

2 条评论

  • @ 2014-08-21 20:14:15

    另外不需要用实数吧,直接取模就可以啦

  • @ 2014-08-21 20:13:38

    亲,这题用string读会爆的。要用ansistring或while not(eoln(input)) do

    • @ 2014-08-22 08:30:37

      测试数据 #0: Accepted, time = 0 ms, mem = 804 KiB, score = 10
      测试数据 #1: WrongAnswer, time = 15 ms, mem = 1096 KiB, score = 0
      测试数据 #2: WrongAnswer, time = 0 ms, mem = 1100 KiB, score = 0
      测试数据 #3: WrongAnswer, time = 0 ms, mem = 1096 KiB, score = 0
      测试数据 #4: RuntimeError, time = 3 ms, mem = 1100 KiB, score = 0
      测试数据 #5: RuntimeError, time = 0 ms, mem = 1100 KiB, score = 0
      测试数据 #6: WrongAnswer, time = 0 ms, mem = 1100 KiB, score = 0
      测试数据 #7: WrongAnswer, time = 0 ms, mem = 1100 KiB, score = 0
      测试数据 #8: WrongAnswer, time = 54 ms, mem = 2092 KiB, score = 0
      测试数据 #9: WrongAnswer, time = 42 ms, mem = 2092 KiB, score = 0
      RuntimeError, time = 114 ms, mem = 2092 KiB, score = 10

      用了ansistring之后- -

  • 1

信息

ID
1849
难度
7
分类
(无)
标签
递交数
3446
已通过
731
通过率
21%
被复制
2
上传者