Array Size In Codeforces

Правка en5, от Adhami, 2017-07-31 07:50:57

I was solving 408B and it was easy. I submitted the code and I get WA in test 15. Then I have revised the code and changed the arrays' size from 1000 to 1005 and it worked! In the problem maximum length of both strings is 1000. why did that happen? first submission WA on test 15 : 28983405. second submission Accepted : 28983523

please do not down vote before telling me what is the wrong in my question

UPD: Thanks to fresher96 for his explanation

UPD:scanf format string article in Wikipedia mentions that:

%s : Scan a character string. The scan terminates at whitespace. A null character is stored at the end of the string, which means that the buffer supplied must be at least one character longer than the specified input length.

Теги array, array limit

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский Adhami 2017-07-31 07:50:57 361
en4 Английский Adhami 2017-07-30 10:42:16 64 Tiny change: 'stion \n\n' -> 'stion \n\nUPD: Thanks to [user:fresher96] for his explanation\n'
en3 Английский Adhami 2017-07-30 09:43:38 2 Tiny change: ' is the wring in my q' -> ' is the wrong in my q'
en2 Английский Adhami 2017-07-30 09:43:01 81
en1 Английский Adhami 2017-07-30 09:15:18 533 Initial revision (published)