【求助】我居然改了一个多小时还是没AC!

P1303 A*B Problem

雷电音 @ 2015-10-30 19:25:45

我修改了好几十遍了,题解也看过了,课本例题也看过了,思想方法完全一致,可是就是过不了最后一个点……求助……

[hr] 花括号里的很多句子和其他句子是等价的(至少我认为),可是同样过不了……

[hr] [codep]

var sra,srb:ansistring;
    a,b,jw,la,lb,lc:longint;
    sa,sb,sc:array[1..2000] of qword{longint};
begin
 fillchar(sa,sizeof(sa),0);
 fillchar(sb,sizeof(sb),0);
 fillchar(sc,sizeof(sc),0);
 readln(sra);
 readln(srb);
 jw:=0;
 {if (sra[1]='-') or (srb[1]='-') then
   if (sra[1]='-') and (srb[1]<>'-') then
     begin
      write('-');
      delete(sra,1,1);
     end
     else if (sra[1]<>'-') and (srb[1]='-') then
       begin
        write('-');
        delete(srb,1,1);
       end
       else begin delete(sra,1,1); delete(srb,1,1); end;}
 la:=length(sra); lb:=length(srb);
 for a:=1 to la do sa[a]:=ord(sra[la-a+1])-48;
 for b:=1 to lb do sb[b]:=ord(srb[lb-b+1])-48;
 lc:=la+lb;
 for a:=1 to la do
   {begin}
    for b:=1 to lb do
      {begin}
       sc[a+b-1]:=sc[a+b-1]+sa[a]*sb[b];{+jw;
       jw:=sc[a+b-1] div 10;
       sc[a+b-1]:=sc[a+b-1] mod 10;
      end;
    sc[a+b]:=sc[a+b]+jw;
    jw:=0; }
  { end;
   end;}
 for a:=1 to lc do
   begin
    jw:=sc[a] div 10;
    sc[a]:=sc[a] mod 10;
    inc(sc[a+1],jw);
   end;
 while (lc>1) and (sc[lc]=0) do dec(lc);
 for a:=lc downto 1 do write(sc[a]);
end.

[/codep]


by 雷电音 @ 2015-11-01 23:24:52

没事了……数组开小了……


by 凭栏 @ 2015-11-02 21:55:54

数组开多少位?


by 水电费 @ 2015-11-14 15:46:12

@[url=/space/show?uid=11270]仰望星空[/url] 1000


by 朝L夕 @ 2015-12-09 21:59:19

hey康康好久不见


by S1K2N3 @ 2016-08-03 12:47:10

呵呵


|