求助(20分)

P1303 A*B Problem

snaptrap @ 2017-02-10 14:19:17

为什么只有20分?!

var a,b,c:array[1..1000] of longint;
    n1,n2:string;
    l1,l2,l3,x,i,j:longint;
    begin
    readln(n1);
    readln(n2);
    if (n1[1]='-')and(n2[1]='-') then begin
    delete(n1,1,1);
    delete(n2,1,1);
    end
    else if(n1[1]='-')or(n2[1]='-') then begin
    write('-');
    if n1[1]='-' then delete(n1,1,1);
    if n2[1]='-' then delete(n2,1,1);
    end;
    l1:=length(n1);
    l2:=length(n2);
    for i:=1 to l1 do a[l1-i+1]:=ord(n1[i])-48;
    for i:=1 to l2 do b[l2-i+1]:=ord(n1[i])-48;
    for i:=1 to l1 do
    begin
    x:=0;
    for j:=1 to l2 do
    begin
    c[i+j-1]:=c[i+j-1]+a[i]*b[j]+x;
    x:=c[i+j-1] div 10;
    c[i+j-1]:=c[i+j-1] mod 10;
    end;
    c[i+j]:=x;
    end;
    l3:=l1+l2;
    while (c[l3]=0)and(l3>1) do dec(l3);
    for i:=l3 downto 1 do
    write(c[i]);
end.

by beng @ 2017-02-22 20:08:19

数组大小+ansistring


by 祝君成 @ 2017-03-10 19:46:28

var
    a,b,c:longint;
begin
  c:=a+b;
  write(c);
emd.

by 徐卓然666 @ 2017-04-29 17:38:27

楼上的傻子,你是不是P党的啊!这高精度还编成普通的A+B。还有结尾,是end.还emd.真会扯。都丢人,可要脸了!


by Hunterz @ 2017-04-29 22:44:54

@徐卓然666 应该是刚刚上手而已,可以体谅的,我们都经历过


by 徐卓然666 @ 2017-04-30 11:13:25

@祝君成——醉了,你这程序


|