展开全部
var s1,s2:ansistring;
w1,w2,w3,i,j,x:longint;
a,c,b:array[1..10000]of longint;
begin
readln(s1);
readln(s2);
w1:=length(s1);
w2:=length(s2);
i:=w1;j:=w2;
w1:=0;w2:=0;
while(i>3)do
begin
inc(w1);
a[w1]:=ord(s1[i])-48+(ord(s1[i-1])-48)*10+(ord(s1[i-2])-48)*100+(ord(s1[i-3])-48)*1000;
i:=i-4;
end;
if i<>0 then inc(w1);
case i of
1:a[w1]:=ord(s1[i])-48;
2:a[w1]:=ord(s1[i])-48+ord(s1[i-1])*10-480;
3:a[w1]:=ord(s1[i])-48+ord(s1[i-1])*10-480+ord(s1[i-2])*100-4800;
end;
while(j>3)do
begin
inc(w2);
b[w2]:=ord(s2[j])-48+ord(s2[j-1])*10-480+ord(s2[j-2])*100-4800+ord(s2[j-3])*1000-48000;
j:=j-4;
end;
if j<>0 then inc(w2);
case j of
1:b[w2]:=ord(s2[j])-48;
2:b[w2]:=ord(s2[j])-48+ord(s2[j-1])*10-480;
3:b[w2]:=ord(s2[j])-48+ord(s2[j-1])*10-480+ord(s2[j-2])*100-4800;
end;
for i:=1 to w1 do
for j:=1 to w2 do
begin
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
c[i+j]:=c[i+j]+c[i+j-1] div 10000;
c[i+j-1]:=c[i+j-1] mod 10000;
end;
w3:=w1+w2;
while (c[w3]=0)and(w3>1) do dec(w3);
write(c[w3]);
for i:=w3-1 downto 1 do
begin
if c[i]<10 then write('000');
if(c[i]<100)and(c[i]>=10)then write('00');
if(c[i]<1000)and(c[i]>=100)then write('0');
write(c[i]);
end;
writeln;
end.
w1,w2,w3,i,j,x:longint;
a,c,b:array[1..10000]of longint;
begin
readln(s1);
readln(s2);
w1:=length(s1);
w2:=length(s2);
i:=w1;j:=w2;
w1:=0;w2:=0;
while(i>3)do
begin
inc(w1);
a[w1]:=ord(s1[i])-48+(ord(s1[i-1])-48)*10+(ord(s1[i-2])-48)*100+(ord(s1[i-3])-48)*1000;
i:=i-4;
end;
if i<>0 then inc(w1);
case i of
1:a[w1]:=ord(s1[i])-48;
2:a[w1]:=ord(s1[i])-48+ord(s1[i-1])*10-480;
3:a[w1]:=ord(s1[i])-48+ord(s1[i-1])*10-480+ord(s1[i-2])*100-4800;
end;
while(j>3)do
begin
inc(w2);
b[w2]:=ord(s2[j])-48+ord(s2[j-1])*10-480+ord(s2[j-2])*100-4800+ord(s2[j-3])*1000-48000;
j:=j-4;
end;
if j<>0 then inc(w2);
case j of
1:b[w2]:=ord(s2[j])-48;
2:b[w2]:=ord(s2[j])-48+ord(s2[j-1])*10-480;
3:b[w2]:=ord(s2[j])-48+ord(s2[j-1])*10-480+ord(s2[j-2])*100-4800;
end;
for i:=1 to w1 do
for j:=1 to w2 do
begin
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
c[i+j]:=c[i+j]+c[i+j-1] div 10000;
c[i+j-1]:=c[i+j-1] mod 10000;
end;
w3:=w1+w2;
while (c[w3]=0)and(w3>1) do dec(w3);
write(c[w3]);
for i:=w3-1 downto 1 do
begin
if c[i]<10 then write('000');
if(c[i]<100)and(c[i]>=10)then write('00');
if(c[i]<1000)and(c[i]>=100)then write('0');
write(c[i]);
end;
writeln;
end.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询