|
|
back to boardtest 12 - overview 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 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 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 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 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 > (i > '9') || (i < '0') you exclude nine and zero Re: test 12 - overview Posted by Baz 28 Mar 2011 04:18 no, you |
|
|