I got 'Output Limit Exceeded'. Why? {No.1048 Superlong sums.} Const Ch:Array[0..9] Of Char=('0','1','2','3','4','5','6','7','8','9'); Var N:LongInt; X,Y,Last,NineC:LongInt; i,j:LongInt; Begin ReadLn(N); ReadLn(X,Y); Last:=X+Y; For i:=2 To N Do Begin ReadLn(X,Y); If X+Y>=10 Then Begin Write(Ch[Last+1]); For j:=1 To NineC Do Write(Ch[0]); Last:=X+Y-10; NineC:=0; End Else If X+Y=9 Then Inc(NineC) Else Begin Write(Ch[Last]); For j:=1 To NineC Do Write(Ch[9]); Last:=X+Y; NineC:=0; End; End; Write(Ch[Last]); For i:=1 To NineC Do Write(Ch[9]); WriteLn; End. Beacuse "Writeln Posted by Lin 25 Jan 2003 16:32 > {No.1048 Superlong sums.} > Const > Ch:Array[0..9] Of Char= ('0','1','2','3','4','5','6','7','8','9'); > Var > N:LongInt; > X,Y,Last,NineC:LongInt; > i,j:LongInt; > Begin > ReadLn(N); > ReadLn(X,Y); > Last:=X+Y; > For i:=2 To N Do > Begin > ReadLn(X,Y); > If X+Y>=10 Then > Begin > Write(Ch[Last+1]); > For j:=1 To NineC Do > Write(Ch[0]); > Last:=X+Y-10; > NineC:=0; > End > Else If X+Y=9 Then > Inc(NineC) > Else Begin > Write(Ch[Last]); > For j:=1 To NineC Do > Write(Ch[9]); > Last:=X+Y; > NineC:=0; > End; > End; > Write(Ch[Last]); > For i:=1 To NineC Do > Write(Ch[9]); > WriteLn; > End. > I deleted it, but got the same message. {No.1048 Superlong sums.} Const Ch:Array[0..9] Of Char=('0','1','2','3','4','5','6','7','8','9'); Var N:LongInt; X,Y,Last,NineC:LongInt; i,j:LongInt; Begin ReadLn(N); ReadLn(X,Y); Last:=X+Y; For i:=2 To N Do Begin ReadLn(X,Y); If X+Y>=10 Then Begin Write(Ch[Last+1]); For j:=1 To NineC Do Write(Ch[0]); Last:=X+Y-10; NineC:=0; End Else If X+Y=9 Then Inc(NineC) Else Begin Write(Ch[Last]); For j:=1 To NineC Do Write(Ch[9]); Last:=X+Y; NineC:=0; End; End; Write(Ch[Last]); For i:=1 To NineC Do Write(Ch[9]); End. |