讨论 / 为毛只得了10分?
landinglanding 2012-08-15 17:26:00
点我顶贴 收藏 删除
var m,n,i,j,k,l,p,q:longint;

begin

readln(m,n);

p:=m;

q:=n;

l:=0;

repeat

k:=p mod 10;

repeat

j:=q mod 10;

l:=l+k*j;

q:=q div 10;

until q=0;

p:=p div 10;

until p=0;

writeln(l);

end.

#1 zyf111@2015-08-19 17:54:38
回复 删除
var i,j,k,l,n,m:longint;

a,b:array[1..100] of byte;

function f(x,y:longint):longint;

begin

while x>0 do

begin

inc(l);

a[l]:=x mod 10;

x:=x div 10;

end;

while y>0 do

begin

inc(k);

b[k]:=y mod 10;

y:=y div 10;

end;

end;

begin

readln(n,m);l:=0;k:=0;

f(n,m);m:=0;

for i:=l downto 1 do

for j:=k downto 1 do inc(m,a[i]*b[j]);

writeln(m);

end.

查看更多回复
提交回复