var
n,i,j,k,o,w,max:longint;
l:longint;
ch:char;
st:string[4];
a,b:array[1..5000] of longint;
c:array[1..10000] of longint;
{procedure w(a:longint);
var
s:string;
i:integer;
begin
str(a,s);
for i:=length(s) downto 1 do write(s[i]);
end;}
begin
readln(n);
k:=n mod 4;
w:=k;
n:=n div 4;
if k>0 then n:=n+1;
if k>0 then o:=2
else o:=1;
while k>0 do
begin
read(ch);
a[n]:=a[n]*10+(ord(ch)-ord('0'));
dec(k);
end;
for i:=o to n do
begin
read(st);
val(st,a[n-i+1]);
end;
readln;
while w>0 do
begin
read(ch);
b[n]:=b[n]*10+(ord(ch)-ord('0'));
dec(w);
end;
for i:=o to n do
begin
read(st);
val(st,b[n-i+1]);
end;
fillchar(c,sizeof(c),0);
max:=0;
for i:=1 to n do
for j:=1 to n do
begin
l:=i+j-1;
c[l]:=c[l]+a[i]*b[j];
while c[l]>=10000 do
begin
c[l+1]:=c[l+1]+(c[l] div 10000);
c[l]:=c[l] mod 10000;
inc(l);
end;
if l>max then max:=l;
end;
write(c[max]);
for i:=max-1 downto 1 do
if c[i]>=1000
then write(c[i])
else if c[i]>=100
then write('0',c[i])
else if c[i]>=10
then write('00',c[i])
else write('000',c[i]);
writeln;
end.
状态: Accepted
测评机: Virmain[1]
得分: 100分 [我要评价一下题目~]
提交日期: 2013-10-25 22:03:00
有效耗时: 5516毫秒
RQNOJ近期在线比赛列表
RQNOJ2013年十月月赛 时间:2013-10-26 18:30:00 [报名]
RQNOJ2013年十一月月赛 时间:2013-11-02 18:30:00 [报名]
测试结果1: 通过本测试点|有效耗时203ms
测试结果2: 通过本测试点|有效耗时94ms
测试结果3: 通过本测试点|有效耗时93ms
测试结果4: 通过本测试点|有效耗时110ms
测试结果5: 通过本测试点|有效耗时797ms
测试结果6: 通过本测试点|有效耗时844ms
测试结果7: 通过本测试点|有效耗时828ms
测试结果8: 通过本测试点|有效耗时859ms
测试结果9: 通过本测试点|有效耗时860ms
测试结果10: 通过本测试点|有效耗时828ms
提交代码: view sourceprint?01.var
02.
n,i,j,k,o,max:longint;
03.
l:longint;
04.
ch:char;
05.
st:ansistring;
06.
s:string;
07.
a,b:array[1..5050] of longint;
08.
c:array[1..10010] of longint;
09.begin
10.
readln(n);
11.
readln(st);
12.
o:=1; k:=length(st);
13.
while k>=4 do
14.
begin
15.
s:=copy(st,k-3,4);
16.
val(s,a[o]);
17.
inc(o);
18.
delete(st,k-3,4);
19.
k:=k-4;
20.
end;
21.
if k>0 then val(st,a[o])
22.
else dec(o);
23.
readln(st);
24.
o:=1; k:=length(st);
25.
while k>=4 do
26.
begin
27.
s:=copy(st,k-3,4);
28.
val(s,b[o]);
29.
inc(o);
30.
delete(st,k-3,4);
31.
k:=k-4;
32.
end;
33.
if k>0 then val(st,a[o])
34.
else dec(o);
35.
36.
37.
38.
fillchar(c,sizeof(c),0);
39.
max:=0;
40.
for i:=1 to o do
41.
for j:=1 to o do
42.
begin
43.
l:=i+j-1;
44.
c[l]:=c[l]+a[i]*b[j];
45.
while c[l]>=10000 do
46.
begin
47.
c[l+1]:=c[l+1]+(c[l] div 10000);
48.
c[l]:=c[l] mod 10000;
49.
inc(l);
50.
end;
51.
if l>max then max:=l;
52.
end;
53.
54.
write(c[max]);
55.
for i:=max-1 downto 1 do
56.
if c[i]>=1000
57.
then write(c[i])
58.
else if c[i]>=100
59.
then write('0',c[i])
60.
else if c[i]>=10
61.
then write('00',c[i])
62.
else write('000',c[i]);
63.
64.
writeln;
65.end.