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

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

test 12 - overview
Послано Iskren Ivov Chernev 6 окт 2007 23:45
Hi everyone!

I had WA#12 for quite a long time, even after I had tried all the tests listed here. I finally got AC after I checked the input for space characters (isspace). After that I hardcoded a check for ' ', '\n', '\r', '\t', '\v', '\f', '\a', '\b', (and removed the isspace) and it gave me WA. In the C standart isspace gives true only for space, newline (\n), carrige return (\r), horizontal tab (\t), vertical tab (\v), form feed (\f) AND others depending on the locale... I cannot understand what kind of symbols they have put in this test case because my program doesn't allow any whitespace at all (I handle each character one by one, and I look for perfect match for isdigit, '+', '-', '\0', 'e', 'E', so I just cant miss a space character) I suggest review of this test case and removing any fancy characters found in it.

If someone wants to see my solution email me iskren [dot] chernev [at] gmail [dot] com
Re: test 12 - overview
Послано Nick J 8 окт 2007 21:52
You are right. It's a very strange test case. I couldn't pass without isspace().
Re: test 12 - overview
Послано Lomir 8 ноя 2007 19:51
There can not be any spaces or other stuff in the line? If there some simbol except { 0123456789+-.eE } I must print not floating point number. Am I right?
Btw, I use gets() to read lines...

Passed all test form the board however WA 12...
Re: test 12 - overview
Послано Chmel_Tolstiy 3 июл 2008 22:25
I had the same problem. I start to think that std::string works not correct with such simbols.

Thanks a lot.
Re: test 12 - overview
Послано Vedernikoff Sergey 3 июл 2008 22:49
You are not right, guys. There is nothing special in 12 test as regards symbolic input. The trouble is in incorrect algorithm - only after I've found serious bug in my prog it easily got AC.
Re: test 12 - overview
Послано Chmel_Tolstiy 4 июл 2008 19:26
really trouble in isdigit()

if you add such code:
    for (int i = 0; i < 256; i++) {
        char c = i;
        //cout << i << endl;
        if (isdigit(c) && ((i > '9') || (i < '0')))
                   cout << i << endl;
    }

you will get a WA1. it's trouble with intel c++ as aI understand. My first guess was wrong about srd::string

Vedernikoff Sergey:
 I think you didn't use isdigit in your code.

Edited by author 04.07.2008 19:45

Edited by author 04.07.2008 19:45
Re: test 12 - overview
Послано Chmel_Tolstiy 4 июл 2008 19:44
if you wrote your own isdigit can hehp you. for example such code:

bool isdigit(char c) {
 return c >= '0' && c <= '9';
}
Re: test 12 - overview
Послано gvsmirnov 30 май 2009 23:55
> (i > '9') || (i < '0')
you exclude nine and zero
Re: test 12 - overview
Послано Baz 28 мар 2011 04:18
no, you