加法:var
i,j,l,k,x,p,q:byte;
s,w,s1,s2,w1,w2:string;
a,b:array[1..100000] of longint;
begin
while not eof do begin
readln(s);
readln(w);
p:=0;
q:=0;
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
l:=0;
k:=0;
x:=0;
i:=0;
j:=0;
for i:=1 to length(s) do if s[i]='.' then begin p:=i; break; end;
for i:=1 to length(w) do if w[i]='.' then begin q:=i; break; end;
if p<>0 then begin s1:=copy(s,1,p-1); s2:=copy(s,p+1,length(s)); end;
if q<>0 then begin w1:=copy(w,1,q-1); w2:=copy(w,q+1,length(w)); end;
if p=0 then s1:=s;
if q=0 then w1:=w;
if (p<>0) and (q<>0) then begin
if length(s2)>length(w2) then begin
l:=length(s2); k:=length(w2);
for i:=1 to l-k do
w2:=w2+'0';
end
else begin
l:=length(s2); k:=length(w2);
for i:=1 to k-l do
s2:=s2+'0';
l:=k;
end;
for i:=l downto 1 do
if ord(s2[i])+ord(w2[i])-96+j>9 then begin
b[i]:=ord(s2[i])+ord(w2[i])+j-106;
j:=1;
end
else begin
b[i]:=ord(s2[i])+ord(w2[i])+j-96;
j:=0;
end;
x:=l;
end;
if length(s1)>length(w1) then begin
l:=length(s1); k:=length(w1);
for i:=1 to l-k do
w1:='0'+w1;
end
else begin
l:=length(s1); k:=length(w1);
for i:=1 to k-l do
s1:='0'+s1;
l:=k;
end;
a[l]:=a[l]+j;
j:=0;
for i:=l downto 1 do
if ord(s1[i])+ord(w1[i])-96+j+a[i]>9 then begin
a[i]:=a[i]+ord(s1[i])+ord(w1[i])+j-106;
j:=1;
end
else begin
a[i]:=a[i]+ord(s1[i])+ord(w1[i])+j-96;
j:=0;
end;
if j<>0 then write(j);
for i:=1 to l do write(a[i]);
if (p<>0) or (q<>0) then write('.');
if (p<>0) and (q<>0) then for i:=1 to x do write(b[i])
else if (p=0) and (q<>0) then write(w2)
else if (p<>0) and (q=0) then write(s2);
writeln;
end;
乘法var
i,j,l,k:byte;
s,w:string;
a:array[1..1000000] of longint;
begin
while not eof do begin
readln(s);
readln(w);
fillchar(a,sizeof(a),0);
for k:=length(w) downto 1 do begin
j:=0;
for i:=length(s) downto 1 do
if (ord(s[i])-48)*(ord(w[k])-48)+j>9 then begin
a[i+k]:=a[i+k]+(ord(s[i])-48)*(ord(w[k])-48) div 10;
a[i+k-1]:=a[i+k-1]+((ord(s[i])-48)*(ord(w[k])-48)+j) mod 10
end
else begin
a[i+k-1]:=a[i+k-1]+(ord(s[i])-48)*(ord(w[k])-48);
end;
end;
for i:=1 to length(s)+length(w)-1 do write(a[i]);
if a[length(s)+length(w)]<>0 then write(a[length(s)+length(w)]);
writeln;
end;
end.
end.
i,j,l,k,x,p,q:byte;
s,w,s1,s2,w1,w2:string;
a,b:array[1..100000] of longint;
begin
while not eof do begin
readln(s);
readln(w);
p:=0;
q:=0;
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
l:=0;
k:=0;
x:=0;
i:=0;
j:=0;
for i:=1 to length(s) do if s[i]='.' then begin p:=i; break; end;
for i:=1 to length(w) do if w[i]='.' then begin q:=i; break; end;
if p<>0 then begin s1:=copy(s,1,p-1); s2:=copy(s,p+1,length(s)); end;
if q<>0 then begin w1:=copy(w,1,q-1); w2:=copy(w,q+1,length(w)); end;
if p=0 then s1:=s;
if q=0 then w1:=w;
if (p<>0) and (q<>0) then begin
if length(s2)>length(w2) then begin
l:=length(s2); k:=length(w2);
for i:=1 to l-k do
w2:=w2+'0';
end
else begin
l:=length(s2); k:=length(w2);
for i:=1 to k-l do
s2:=s2+'0';
l:=k;
end;
for i:=l downto 1 do
if ord(s2[i])+ord(w2[i])-96+j>9 then begin
b[i]:=ord(s2[i])+ord(w2[i])+j-106;
j:=1;
end
else begin
b[i]:=ord(s2[i])+ord(w2[i])+j-96;
j:=0;
end;
x:=l;
end;
if length(s1)>length(w1) then begin
l:=length(s1); k:=length(w1);
for i:=1 to l-k do
w1:='0'+w1;
end
else begin
l:=length(s1); k:=length(w1);
for i:=1 to k-l do
s1:='0'+s1;
l:=k;
end;
a[l]:=a[l]+j;
j:=0;
for i:=l downto 1 do
if ord(s1[i])+ord(w1[i])-96+j+a[i]>9 then begin
a[i]:=a[i]+ord(s1[i])+ord(w1[i])+j-106;
j:=1;
end
else begin
a[i]:=a[i]+ord(s1[i])+ord(w1[i])+j-96;
j:=0;
end;
if j<>0 then write(j);
for i:=1 to l do write(a[i]);
if (p<>0) or (q<>0) then write('.');
if (p<>0) and (q<>0) then for i:=1 to x do write(b[i])
else if (p=0) and (q<>0) then write(w2)
else if (p<>0) and (q=0) then write(s2);
writeln;
end;
乘法var
i,j,l,k:byte;
s,w:string;
a:array[1..1000000] of longint;
begin
while not eof do begin
readln(s);
readln(w);
fillchar(a,sizeof(a),0);
for k:=length(w) downto 1 do begin
j:=0;
for i:=length(s) downto 1 do
if (ord(s[i])-48)*(ord(w[k])-48)+j>9 then begin
a[i+k]:=a[i+k]+(ord(s[i])-48)*(ord(w[k])-48) div 10;
a[i+k-1]:=a[i+k-1]+((ord(s[i])-48)*(ord(w[k])-48)+j) mod 10
end
else begin
a[i+k-1]:=a[i+k-1]+(ord(s[i])-48)*(ord(w[k])-48);
end;
end;
for i:=1 to length(s)+length(w)-1 do write(a[i]);
if a[length(s)+length(w)]<>0 then write(a[length(s)+length(w)]);
writeln;
end;
end.
end.