信息爱好者集中

来源:百度知道 编辑:UC知道 时间:2024/05/08 19:54:56
var
v:char;
a,b,c,d,p:integer;
s:string;

procedure try(s:string; var x,y:integer);
var
p,f,tot,k:integer;
ch:string;
begin
x:=0; y:=0; p:=1;ch:='';
while p<=length(s) do
begin
f:=1;
case s[p] of
'-': begin f:=-1; inc(p); end;
'+': begin f:=1; inc(p); end;
end;
if s[p]=v then tot:=1
else begin
while (p<=length(s)) and (s[p] in ['0'..'9']) do
begin
ch:=ch+s[p];
inc(p);
end;
k:=ord(ch)-48;tot:=f*k;
end;
if (p<=length(s))and(s[p]=v) then
begin
x:=x+tot;
inc(p);
end
else
y:=y+tot;
end;
end;

begin
readln(s);
p:=pos('=',s);
for v:='a' to 'z' do
if pos(v,s)>0 then break;
try(copy(s,1,

var
i,lcx,lc0,rcx,rc0 : longint;
eqution,left,right : string;

procedure turn(ex : string; var cx,c0 : longint);
var
i,c : longint;
flag : boolean;
item : string;
begin
i := 1;
cx := 0;
c0 := 0;
while i <= length(ex) do begin
flag := true;
c := 0;
repeat
if ex[i] = '-' then
flag := false;
if (ex[i] >= '0') and (ex[i] <= '9')
then c := c * 10 + ord(ex[i]) - 48;
i := i + 1;
until(i > length(ex))or(ex[i] = '+')or(ex[i] = '-');
if (c = 0)and(not(ex[i-1] in ['0'..'9']))and(ex[i-2] <> '0')
then c := 1;
if (ex[i-1] >='0')and (ex[i-1] <= '9')
then if flag then c0 := c0 + c
else c0 := c0 - c
else if flag then cx := cx + c
else cx := cx - c;
end;
end;

begin
write(&