WA brackets "()"

bitwise
codecracker
sept15
wa

#1

This query is related to the recent long challenge’s codecracker question.Can anyone please tell me why https://www.codechef.com/viewsolution/8169233 solution failed and https://www.codechef.com/viewsolution/8169229 solution passed even though there is difference in brackets between (I&1)==(K&1) in the twelth line and everything else in the two solutions is the exact same??


#2

COMPRISON(==) operator has high precedence than BITWISE AND(&) check here.

In the WA solution l&1==k&1 it will be calculated l&(1==k)*1.

For the AC solution “()” do the right job for you as they have the high precedence.

Hope you understood the difference.