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

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

For those who can't pass test 1 in C++
Послано Robert Ayrapetyan 6 янв 2014 04:17
I'm not quite sure where the problem is, but here is the story. First, I tried to submit solution which worked well on my machine (64bit OS), but test 1 was constantly failed on timus server. I've tried to change (almost) everything in my code without success. Then I started to google solutions. Surprisingly, they didn't worked either (e.g. http://helloacm.com/coding-exercise-timus-1001-reverse-root-c-solution-online-judge/ is provided as a working solution, but it also fails on test 1). I've started to think that something is broken on the timus server or I'm choosing wrong compiler version or hell knows what else. Then I've found another solution which was... accepted! Started to comparing it with mine line by line and found following:
whatever I use in scanf (llu, lld) - it works fine on my machine, but on remote server it fails. When you replace scanf by cin - it works both locally and remotely. So in short - do not use scanf for this task, use cin.
It will be very interesting to know why this happens, maybe someone could explain?
Re: For those who can't pass test 1 in C++
Послано [ONPU-13]Asalle 2 фев 2014 21:02
What do you mean by "not working"? WA or sth else?
As  for me, it doesn't work either way. Either scanf, or cin it's wa1, I don't know why.
Pechal'
Re: For those who can't pass test 1 in C++
Послано yeahin 25 мар 2014 09:37
Right, somehow sscanf("%lld") doesn't work.  Use strtoll() instead.