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 1074. Very Short Problem

test 12 - overview
Posted by Iskren Ivov Chernev 6 Oct 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
Posted by Nick J 8 Oct 2007 21:52
You are right. It's a very strange test case. I couldn't pass without isspace().
Re: test 12 - overview
Posted by Lomir 8 Nov 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
Posted by Chmel_Tolstiy 3 Jul 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
Posted by Vedernikoff Sergey 3 Jul 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
Posted by Chmel_Tolstiy 4 Jul 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
Posted by Chmel_Tolstiy 4 Jul 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
Posted by gvsmirnov 30 May 2009 23:55
> (i > '9') || (i < '0')
you exclude nine and zero
Re: test 12 - overview
Posted by Baz 28 Mar 2011 04:18
no, you