|
|
вернуться в форумshould I consider a file stream or an ordinary console I/O ? Послано Friz 25 сен 2008 20:37 it's obvious that it's impossible to consider console i/o because then the end of input would have to be designated by something ,like pressing a special button, but this is not mentioned in condition. so, input stream is from file. but what is a filename , and where is it located ? I've considered a file stream, but i think if there were a problem about file's location , then this would give a compilation error, but i receive wrong answer. i wonder what is the motivation ? as far as I know , while reading from file, all #32 ,#10 and #13 are skipped. i think the only problem can be a size of resulting output array which is of course not even close to 256K. The else should be fine . : ( program pr; const size = 10785; var a :real; i, j :integer; numbs :file of real; massive : array[1..size] of real; begin i:=1; assign(numbs,'c:\file1'); reset(numbs); while not eof(numbs) do begin if ( i > size ) then exit; read( numbs ,a ); massive[i]:=sqrt( a ); i:=i + 1; end; close( numbs ); for j:=i downto 1 do write(massive[j]:0:4); end. Edited by author 25.09.2008 20:39 Edited by author 25.09.2008 20:42 Edited by author 25.09.2008 20:47 Re: should I consider a file stream or an ordinary console I/O ? Before solving problems from Timus Online Judge, please, read FAQ carefully. Re: should I consider a file stream or an ordinary console I/O ? Послано Friz 25 сен 2008 22:32 Oh, I see , no file stream . yet , there is still a dark point . Can the limitation on the size of array be a reason ? program pr; const size = 10806; var a : real; i, j : integer; massive : array[1..size] of real; begin i := 0; while not eof do begin if ( i + 1 > size) then break; i:= i + 1; read(a); massive[i] := sqrt(a); end; for j := i downto 1 do writeln(massive[j]:0:4); end. Edited by author 25.09.2008 23:35 Edited by author 25.09.2008 23:36 |
|
|