测评机: Xeond[6]
得分: 89分
提交日期: 2008-11-8 12:10:00
有效耗时: 391毫秒
测试结果1: 输出过少|用户输出数据少于标准输出的50%[标准输出229位|选手输出15位]
测试结果2: 通过本测试点|有效耗时47:ms
测试结果3: 通过本测试点|有效耗时47:ms
测试结果4: 通过本测试点|有效耗时47:ms
测试结果5: 通过本测试点|有效耗时47:ms
测试结果6: 通过本测试点|有效耗时47:ms
测试结果7: 通过本测试点|有效耗时47:ms
测试结果8: 通过本测试点|有效耗时47:ms
测试结果9: 通过本测试点|有效耗时62:ms
var st,s1,s2,mid:string;
k,l,r,x,n,pp:longint;
tt:boolean;
procedure sub(var ss:string);
var tf:boolean;
i:longint;
begin
if ss[1]=’x’ then ss:=’1*’+ss;
repeat
tf:=true;
for i:=1 to length(ss) do
if (ss[i]=’x’) and (i>1) then
if ss[i-1] in [’0’..’9’] then begin tf:=false; break; end;
if tf=false then insert(’*’,ss,i);
until tf=true;
end;
function f(st:string):longint;
var i,j,ok,jj,cc,kk:longint;
ll,rr,mm:string;
begin
if st=’’ then begin f:=0; exit; end;
if st=’x’ then begin f:=x; exit; end;
val(st,i,ok); if ok=0 then begin f:=i; exit; end;
jj:=0; cc:=0;
for i:=length(st) downto 1 do
if (st[i]=’+’) or (st[i]=’-’) then begin jj:=i; break; end;
for i:=length(st) downto 1 do
if st[i]=’*’ then begin cc:=i; break; end;
if jj>0 then kk:=jj else kk:=cc;
ll:=copy(st,1,kk-1); rr:=st; delete(rr,1,kk-1);
mm:=rr[1]; delete(rr,1,1);
if mm=’+’ then f:=f(ll)+f(rr);
if mm=’-’ then f:=f(ll)-f(rr);
if mm=’*’ then f:=f(ll)*f(rr);
end;
begin
readln(st); while pos(’ ’,st)<>0 do delete(st,pos(’ ’,st),1);
if pos(’=’,st)<>0 then begin
k:=pos(’=’,st);
if (st[k-1]=’>’) or (st[k-1]=’<’) then begin
s1:=copy(st,1,k-2); s2:=st; delete(s2,1,k-2);
mid:=copy(s2,1,2); delete(s2,1,2);
end else begin
s1:=copy(st,1,k-1); s2:=st; delete(s2,1,k-1);
mid:=copy(s2,1,1); delete(s2,1,1);
end;
end else begin
if pos(’<’,st)<>0 then k:=pos(’<’,st);
if st[k+1]<>’>’ then begin
s1:=copy(st,1,k-1); s2:=st; delete(s2,1,k-1);
mid:=copy(s2,1,1); delete(s2,1,1);
end else begin
s1:=copy(st,1,k-1); s2:=st; delete(s2,1,k-1);
mid:=copy(s2,1,2); delete(s2,1,2);
end;
end;
sub(s1); sub(s2); x:=0;
pp:=f(s1)-f(s2); tt:=false;
for x:=-1 to 1 do
if f(s1)-f(s2)<>pp then begin tt:=true; break; end;
if tt then begin
readln(n);
for k:=1 to n do begin
readln(x);
l:=f(s1); r:=f(s2);
if (mid=’>’) and (l>r) then writeln(x);
if (mid=’<’) and (l<r) then writeln(x);
if (mid=’=’) and (l=r) then writeln(x);
if (mid=’>=’) and (l>=r) then writeln(x);
if (mid=’<=’) and (l<=r) then writeln(x);
if (mid=’<>’) and (l<>r) then writeln(x);
end;
end else begin
writeln(’Are you sure?’);
end;
end.
不过测试结果3: 输出过长|用户输出数据超过标准输出两倍[标准输出6位|选手输出521位]