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 1408. Polynomial Multiplication

Strange test #13
Posted by SevenEleven [Tartu U] 2 Jan 2009 16:05
when I changed

char buf[100];
cin.getline(buf, 100);

to

char buf[1000];
cin.getline(buf, 1000);

I got AC, but problem statement says that polynom's length is no longer than 100 characters.
Re: Strange test #13
Posted by Sandro (USU) 3 Jan 2009 14:48
Because there is a '\0' character in the end of string, so for string with length 100 you should use "char buf[101]".
Re: Strange test #13
Posted by 198808xc 29 Sep 2010 19:19
And, when you use cin.getline() to read a line of max-length 100, you should write:
cin.getline(*, 101, '\n');
instead of
cin.getline(*, 100, '\n');