c++ scanf question

Revision en1, by eambutu, 2016-08-21 08:47:28

I am new to C++ so sorry if this question is dumb.

I am solving this problem: http://codeforces.me/contest/707/problem/A

And couldn't understand why this solution failed: http://codeforces.me/contest/707/submission/20019326 According to http://www.cplusplus.com/reference/cstdio/scanf/ , the %s tag should only take one character at a time, right? So reading into a 1 element character array should be fine. Switching variable x to a 2 element character array makes this work for some reason.

Also, the particular test case that fails works locally for me?

Tags c++, new

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English eambutu 2016-08-21 08:47:28 586 Initial revision (published)