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

Обсуждение задачи 1074. Очень короткая задача

several tricky cases i failed at
Послано Koala 6 ноя 2009 02:13
1) the exponent may be very large (absolute value). e.g. -100000000000000000000000000000000000.
2) the exponent may pretend to be very large, but actually not. e.g. 000000000000000000000000000000000010
3) 12.e1 is not a valid floating point number, because the dot cannot be the last character of the integral part according to the grammar mentioned.

good luck
Re: several tricky cases i failed at
Послано [Ural SU] GetTester 27 ноя 2009 12:38
try also tests such as
--1
1
Re: several tricky cases i failed at
Послано Petr Huggy (Pskov) 2 июн 2010 13:49
I used conversion String to BigDecimal in Java. But cases 1 and 3 (in Koala's message) should be processed separately.
To process very large negative exponent I used the following
String res;
try {
   res = bd.toPlainString();
}
catch (OutOfMemoryError e) {
// gets here if exp < -1000000
   res = "0.0"; // no need to keep any digits if exp < -200
}
But I don't like it. And maybe it's wrong?
Nevertheless I still have WA 12 :)))


Edited by author 02.06.2010 13:54