|
|
back to boardWhat is wrong? On my computer get the correct result (Pascal) I'm worn out already. Lasarus compiled code. FPC version - 2.6.0. Get the right result. Send in the check, get - Wrong answer (test 3). var c: char; i:longint; l:extended; numbers: array of extended; begin l:=-1; SetLength(numbers,0); while not Eof do begin Read(c); if c in ['0'..'9'] then begin if l=-1 then l:=Ord(c)-48 else l:=l*10+Ord(c)-48; end else begin if l<>-1 then begin SetLength(numbers,length(numbers)+1); numbers[length(numbers)-1]:=sqrt(l); end; l:=-1; end; end; for i:=length(numbers)-1 downto 0 do writeln(numbers[i]:0:4); end. Re: What is wrong? On my computer get the correct result (Pascal) I think couldn't use array to save numbers because size of array not enought to contain. I think on your computer get the correct result because file input data only contain some value, not too much |
|
|