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

×

CONFLIP Getting WA

Please tell me the error in my code http://www.codechef.com/viewsolution/3930436

asked 21 May '14, 18:42

pulkitsinghal's gravatar image

6★pulkitsinghal
35729
accept rate: 43%


Hey, just change

if(n&1==0)

to

if((n&1)==0)

This is a common mistake. While dealing with binary operators, '==' takes precedence over ' & '.

Hence, "1==0" is computed before "n & 1".

Here is the correct solution - www.codechef.com/viewsolution/3930657

link

answered 21 May '14, 20:16

wittyceaser's gravatar image

4★wittyceaser
3.4k194372
accept rate: 15%

Thank you very much :)

(21 May '14, 20:38) pulkitsinghal6★

Hi

Can you please check my code. It throws WA.

https://www.codechef.com/viewsolution/13362508

link

answered 20 Apr, 23:19

shainsha's gravatar image

0★shainsha
91
accept rate: 0%

1

@shainsha you cannot use Scanner and BufferedReader simultaneously on System.in. That is because both Scanner and BufferedReader use buffers to read from the input stream. As a result when you use the Scanner first the Scanner's buffer is filled to it's capacity (1024 chars), and not just what it returns. Hence what is left for the BufferedReader in the input stream is less than what you think.
In summary, use Scanner or BufferedReader, but not both.

(20 Apr, 23:58) meooow6★

guys, please upvote me. i am new here. nad not able to ask question

link

answered 21 Apr, 03:07

thinkinfinit's gravatar image

2★thinkinfinit
572
accept rate: 0%

toggle 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

Tags:

×658
×2

Asked: 21 May '14, 18:42

Seen: 369 times

Last updated: 21 Apr, 03:07