|
|
back to boardHelp!Why I always get WA? Posted by Bighead 17 Apr 2002 14:30 I think my program is correct,but it always gets WA,why? Here is my program: program U1048; const digits=100000000; var n1,n2:array[0..200000] of longint; i,j,n,a,b:longint; s:string; begin readln(n); n1[0]:=0; for j:=n div 8*8+1 to n do begin readln(a,b); n1[1]:=n1[1]*10+a; n2[1]:=n2[1]*10+b; end; inc(n1[1],n2[1]); for i:=1 to n div 8 do begin for j:=1 to 8 do begin readln(a,b); n1[i+1]:=n1[i+1]*10+a; n2[i+1]:=n2[i+1]*10+b; end; inc(n1[i+1],n2[i+1]); end; for i:=n div 8+1 downto 1 do if n1[i]>=digits then begin dec(n1[i],digits); inc(n1[i-1]); end; j:=0; while (n1[j]=0)and(j<200000) do inc(j); if n1[j]=0 then writeln(0) else begin write(n1[j]); for i:=j+1 to n div 8+1 do begin str(n1[i],s); while length(s)<8 do s:='0'+s; write(s); end; writeln; end; end. Re: Help!Why I always get WA? Oh, my god!You uses Array? Can you pass the Memory Limited? Maybe you can but you needn't use it at all.:( I'm so sorry that I can't understand you program at all. but If you want ,I'll give you some hint. Give up in this way.OK? Re: Help!Why I always get WA? Posted by sikee8 18 Apr 2002 19:33 Re: Help!Why I always get WA? Posted by Bighead 19 Apr 2002 06:46 > 1 > 0 0 > > your answer - 1 But on my pc my answer is 0.Why? Re: Help!Why I always get WA? Posted by Bighead 19 Apr 2002 06:56 In my program, I use a longint to save 8 digits, so I can pass the memory limit easily, but it always get WA, I really don't know why. Re: Help!Why I always get WA? Posted by sikee8 9 May 2002 06:55 > > 1 > > 0 0 > > > > your answer - 1 > > But on my pc my answer is 0.Why? i don't know. i've use turbo pascal 7.0 ... and, if this test correct. 2 0 0 1 1 your answer is 2 (on my pc ;) ) but your must output 02. |
|
|