You are not logged in. Please login at www.codechef.com to post your questions!

×

HEADBOB - Getting WA when using %c (stdin buffer) and not %s

When I scan the input buffer (gesture string) character by character, I get WA here but not in my CodeBlocks IDE. - Link

When using %s or storing the string in one go into an array, my code gets accepted here. - Link

I have read a similar query here and I assume this is associated with the way stdin works over characters and string array along with input buffers. Can someone help me with a deep explanation of why this works on my IDE but not here? Any words over this would be highly appreciated.

asked 11 Jul '17, 20:22

the_baahubali's gravatar image

3★the_baahubali
1
accept rate: 0%


this is the reason for your wrong answer:

you are breaking the for loop without taking the whole input,then what happens is remaining input is taken as the input for the next testcase .

try this testcase:

2

3

YNI

3

NIN

link

answered 11 Jul '17, 20:48

hruday968's gravatar image

4★hruday968
1.7k210
accept rate: 14%

edited 11 Jul '17, 20:50

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,911
×1,477
×847
×643
×169
×28
×8
×6

question asked: 11 Jul '17, 20:22

question was seen: 714 times

last updated: 11 Jul '17, 20:50