第一个点

├ 测试数据 01:答案错误... ├ 标准行输出

 ├ 错误行输出

├ 测试数据 02:答案正确... 0ms

├ 测试数据 03:答案正确... 0ms

├ 测试数据 04:答案正确... 0ms

├ 测试数据 05:答案正确... 0ms

---|---|---|---|---|---|---|---|-

Unaccepted 有效得分:83 有效耗时:0ms

为什么受伤的总是我

const

st:set of char=['a'..'z','A'..'Z'];

sh:set of char=['1'..'9'];

var

i,k,t,j,l,c,x,y,m:integer;

s:string;

ch:char;

b,b1:boolean;

begin

read(s);

for i:=1 to length(s) do if s[i]='=' then j:=i else if s[i] in st then ch:=s[i];

s:=s+' ';

k:=0;

t:=0;

l:=0;

b:=false;

for i:=1 to j do

begin

if not b then

begin

if s[i]=ch then inc(k)

else if s[i]='-' then begin b:=true; b1:=false; x:=i+1; end

else if s[i]='+' then begin b:=true; b1:=true; x:=i+1; end

else begin b:=true; b1:=true; x:=i; end;

end

else

begin

if s[i]=ch then

begin

if i=x then begin if b1 then inc(k) else dec(k); end

else

begin

val(copy(s,x,i-x),y,c);

if b1 then k:=k+y

else k:=k-y;

end

end

else

begin

if not (s[i] in sh) then

begin

val(copy(s,x,i-x),y,c);

if b1 then t:=t-y else t:=t+y;

end;

if s[i]='-' then begin b:=true; b1:=false; x:=i+1; end

else if s[i]='+' then begin b:=true; b1:=true; x:=i+1; end;

end;

end;

end;

b:=false;

for i:=j+1 to length(s) do

begin

if not b then

begin

if s[i]=ch then dec(k)

else if s[i]='-' then begin b:=true; b1:=false; x:=i+1; end

else if s[i]='+' then begin b:=true; b1:=true; x:=i+1; end

else begin b:=true; b1:=true; x:=i; end;

end

else

begin

if s[i]=ch then

begin

if i=x then begin if not b1 then inc(k) else dec(k); end else begin val(copy(s,x,i-x),y,c); if not b1 then k:=k+y else k:=k-y; end

end

else

begin

if not (s[i] in sh) then

begin

val(copy(s,x,i-x),y,c);

if not b1 then t:=t-y else t:=t+y;

end;

if s[i]='-' then begin b:=true; b1:=false; x:=i+1; end

else if s[i]='+' then begin b:=true; b1:=true; x:=i+1; end;

end;

end;

end;

if t=0 then writeln(ch,'=',0.000:0:3) else writeln(ch,'=',t/k:0:3);

end.

信息

ID
1344
难度
5
分类
模拟 点击显示
标签
递交数
2927
已通过
1018
通过率
35%
被复制
18
上传者