ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1001. Обратный корень

How can we find the end of input file?
Послано Piratek-(akaDK) 31 дек 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?
Послано KIRILL(ArcSTU) 31 дек 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?
Послано Delete 1 янв 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?
Послано KIRILL(ArcSTU) 1 янв 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?
Послано Kit 1 янв 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 (-)
Послано Dmitry 'Diman_YES' Kovalioff 1 янв 2007 13:17
Re: How can we find the end of input file?
Послано KIRILL(ArcSTU) 1 янв 2007 15:05
KIRILL(ArcSTU) писал(a) 1 января 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?
Послано Roma Labish[Lviv NU] 1 янв 2007 20:44
How I can do it on C++ ??
see FAQ again (-)
Послано Kit 1 янв 2007 21:01


Edited by author 01.01.2007 21:02
Re: see FAQ again (-)
Послано Life is short... 1 янв 2007 21:40
thanks, seekeof works fine :)
Re: How can we find the end of input file?
Послано Jerry 3 фев 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?
Послано Roma Labish[Lviv NU] 3 фев 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?
Послано Roma Labish[Lviv NU] 3 фев 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?
Послано Squid 4 фев 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) {
  // ...
}