All about problems in Volume CXII. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
by Scarecrow » Thu Apr 19, 2012 1:23 am
brianfry713 wrote:I did some slight modifications to your code and got AC. Instead of using getchar() and counting on that being a newline, try using while(getchar()!='\n');
That way your code will work if there are trailing whitespaces or DOS style newlines.
thnx

i got AC. but why was the problem occurring ? do they deliberately insert white spaces in the input? can u explain a bit more plz?
Do or do not. There is no try.
-
Scarecrow
- Learning poster
-
- Posts: 69
- Joined: Wed Oct 19, 2011 9:06 pm
by brianfry713 » Thu Apr 19, 2012 10:55 pm
They might add extra spaces and on this problem it seems they did. Make your code handle it in case they do. Always read the problem statement carefully.
-
brianfry713
- Guru
-
- Posts: 1751
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Return to Volume CXII
Who is online
Users browsing this forum: No registered users and 1 guest