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

How can we find the end of input file?
Posted by Piratek-(akaDK) 31 Dec 2006 14:17
I think it's easy problem we can use something like
binary search for find answer , but how can we read
input data :
if it will be input.txt we can do like that
 while not eof do
but it's now console
Re: How can we find the end of input file?
Posted by KIRILL(ArcSTU) 31 Dec 2006 17:56
You don't need to use binary search
All numbers can be stored in extended type
Re: How can we find the end of input file?
Posted by Delete 1 Jan 2007 03:45
If so then it's very simple, but i'm getting WA :(
Isn't simple recurse with sqrt() function not right? why?

I obviously can't read the input correctly.
I do it this way:

while not eof do
begin
  read(a);
  ...
end;
...

Is that right?

Edited by author 01.01.2007 04:03

Edited by author 01.01.2007 04:03
Re: How can we find the end of input file?
Posted by KIRILL(ArcSTU) 1 Jan 2007 04:21
Yes of course sqrt(), but
trouble is to get numbers from flow
You should read text char by char until eof
Numbers can be stored in array without recursion

Edited by author 01.01.2007 04:33
Re: How can we find the end of input file?
Posted by Kit 1 Jan 2007 13:00
You can use "seekeof" function instead of "eof". It presented even in BP7.0, so you can easily find description.
Reading data is fully described in FAQ - http://acm.timus.ru/faq.aspx (-)
Posted by Dmitry 'Diman_YES' Kovalioff 1 Jan 2007 13:17
Re: How can we find the end of input file?
Posted by KIRILL(ArcSTU) 1 Jan 2007 15:05
KIRILL(ArcSTU) wrote 1 January 2007 04:21
Yes of course sqrt(), but
trouble is to get numbers from flow
You should read text char by char until eof
Numbers can be stored in array without recursion

Edited by author 01.01.2007 04:33
I'm stupid :)
It can be solved simple with seekeof
while not seekeof do
...
 read(number);
...

Edited by author 01.01.2007 15:22
Re: How can we find the end of input file?
Posted by Roma Labish[Lviv NU] 1 Jan 2007 20:44
How I can do it on C++ ??
see FAQ again (-)
Posted by Kit 1 Jan 2007 21:01


Edited by author 01.01.2007 21:02
Re: see FAQ again (-)
Posted by Life is short... 1 Jan 2007 21:40
thanks, seekeof works fine :)
Re: How can we find the end of input file?
Posted by Jerry 3 Feb 2007 13:22
Yes,I can't do it too!
It annoyed me for a long time:

[code deleted]

Where's my problem!

Edited by author 03.02.2007 13:22

Edited by moderator 13.02.2007 20:57
Re: How can we find the end of input file?
Posted by Roma Labish[Lviv NU] 3 Feb 2007 14:32
1-st "int" is not enough to input
2-nd try to use printf instead setprecision.
Re: How can we find the end of input file?
Posted by Roma Labish[Lviv NU] 3 Feb 2007 14:37
Here is your AC program:
But better is to use only array, not stack!!!

[code deleted]

Edited by moderator 13.02.2007 20:57
Re: How can we find the end of input file?
Posted by Squid 4 Feb 2007 02:41
And how can I find the end of input using Java? FAQ says nothing about it...

Does it work?
while (in.nextToken() != StreamTokenizer.TT_EOF) {
  // ...
}