|
|
back to boardCommon BoardWhy I got 'Carsh(ACCESS_VIOLATION)'?(Problem 1108) Posted by Lin 15 Oct 2001 20:06 Type Arr = Array[1..32000] of Byte; Var A : Arr; C : Arr; N : Integer; i,j,k : Integer; Last : Integer; First : Integer; L : Integer; P : Longint; P1 : Integer; Begin Readln(N); A[1] := 1; For i := 1 to N-1 do Begin Fillchar(C,Sizeof(C),0); For L := 32000 downto 1 do If A[L]<>0 then Break; C := A; For j := 1 to L*2-1 do Begin Last := (j+1) Div 2; If (j+1) Mod 2=0 then Begin Inc(P,A[(j+1) div 2]*A[(j+1) Div 2]); Dec(Last); End; If j<=L then First := 1 else First := j-L; For k := First to Last do Inc(P,A[k]*A[j+1-k]*2); Inc(P,C[j]); C[j] := P Mod 10; P := P Div 10; End; P1 := L*2-1; While P<>0 do Begin Inc(P1); P := C[P1]+P; C[P1] := P Mod 10; P := P Div 10; End; P := 1; P1 := 1; Repeat P := P+A[P1]; A[P1] := P Mod 10; P := P Div 10; Until P=0; For j := 32000 downto 1 do If A[j]<>0 then Break; For k := j downto 1 do Write(A[k]); Writeln; A := C; End; P := 1; P1 := 1; Repeat P := P+A[P1]; A[P1] := P Mod 10; P := P Div 10; Until P=0; For L := 32000 downto 1 do If A[L]<>0 then Break; For j := L downto 1 do Write(A[j]); End. |
|
|