讨论 / 终于AC
1233211234567 2012-07-15 02:45:00
点我顶贴 收藏 删除
题目:A*B Problem

状态: Accepted

测评机: Xeond[6]

得分: 100分 [我要评价一下题目~]

提交日期: 2012-7-15 17:39:00

有效耗时: 6062毫秒

测试结果1: 通过本测试点|有效耗时172ms

测试结果2: 通过本测试点|有效耗时172ms

测试结果3: 通过本测试点|有效耗时172ms

测试结果4: 通过本测试点|有效耗时172ms

测试结果5: 通过本测试点|有效耗时953ms

测试结果6: 通过本测试点|有效耗时875ms

测试结果7: 通过本测试点|有效耗时875ms

测试结果8: 通过本测试点|有效耗时875ms

测试结果9: 通过本测试点|有效耗时906ms

测试结果10: 通过本测试点|有效耗时890ms

提交代码: view sourceprint?

01.type

02. numbertype=array[0..2000000]of longint;

03. var

04. a,b:numbertype;

05. i,k,len1,len2,ws,j:longint;

06. s1,s2:ansistring;

07.begin

08.readln(ws);

09.readln(s1);

10.readln(s2);

11.for i:=1 to ws do a[ws-i]:=ord(s1[i])-ord('0');

12.for i:=1 to ws do b[ws-i]:=ord(s2[i])-ord('0');

13.for i:=ws-1 downto 0 do

14.begin

15.for j:=ws-1 downto 1 do inc(a[i+j],a[i]*b[j]);

16.a[i]:=a[i]*b[0];

17.end;

18.k:=ws+ws-1;

19.for i:=0 to k-1 do

20.begin

21.inc(a[i+1],a[i] div 10);

22.a[i]:=a[i] mod 10;

23.end;

24.if a[k]<>0 then inc(k);

25.for i:=k-1 downto 0 do write(a[i]);

27.end.

说明,仅供参考

查看更多回复
提交回复