|
|
back to boardHelp!!! Why I get WA?? Here is my code. Somebody please help me to find a mistake! Program n1048; Var A:Array [1..500000] Of Byte; n,i:Longint; k,x1,y1,x2,y2:byte; Begin Readln(N); If (n mod 2)<>0 Then Begin Readln(x1,y1); a[1]:=x1+y1; For i:=1 To (n div 2) Do Begin Readln(X1,Y1);Readln(x2,y2); a[i+1]:=x1*10+x2+y1*10+y2; End; k:=0; For I:=((n div 2) +1) DOWnto 1 Do Begin y1:=a[i]; a[i]:=(y1+k) mod 100; k:=(y1+k) div 100; End; Write(a[1]); For i:=2 To ((n div 2)+1) Do If a[i]<>0 Then Write(a[i]) Else Write(a[i],a[i]); End; If (n mod 2)=0 Then Begin For i:=1 To (n div 2) Do Begin Readln(X1,Y1);Readln(x2,y2); a[i]:=x1*10+x2+y1*10+y2; End; k:=0; For I:=(n div 2) DOWnto 1 Do Begin y1:=a[i]; a[i]:=(y1+k) mod 100; k:=(y1+k) div 100; End; For i:=1 To (n div 2) Do If a[i]<>0 Then Write(a[i]) Else Write(a[i],a[i]); End; Readln; End. Re: Help!!! Why I get WA?? Here is a Test 4 9 0 9 0 9 0 1 9 The Right Answer is 10000 Your Answer is 0000 Do You Test You Program Before Submit It?:) Re: Help!!! Why I get WA?? Posted by Vesper 22 Apr 2004 13:13 They say the length of a sum never exceeds N, so your test is wrong. But still, take that in mind. |
|
|