ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

should I consider a file stream or an ordinary console I/O ?
Posted by Friz 25 Sep 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 ?
Posted by Sandro (USU) 25 Sep 2008 21:33
Before solving problems from Timus Online Judge, please, read FAQ carefully.
Re: should I consider a file stream or an ordinary console I/O ?
Posted by Friz 25 Sep 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