×

XORIER - Sep18 - Can anyone help me out?

 1 link text Above is my solution to War of xor, can anyone tell me what is wrong in my solution ? asked 17 Sep '18, 20:11 23●4 accept rate: 0%

 0 Its integer overflow which is causing you WA. Convert int to long and submit. answered 17 Sep '18, 20:40 4★pant0000 111●4 accept rate: 10%
 1 Thank you soo much for your help. answered 21 Sep '18, 22:52 23●4 accept rate: 0%
 0 still i am getting wa link text answered 19 Sep '18, 11:37 23●4 accept rate: 0% your code slightly updated gives AChttps://www.codechef.com/viewsolution/20237375 (19 Sep '18, 15:54) pant00004★
 0 Look, the multiplication of two integer numbers can give you an answer which is outside the range of int. For example $1000000 * 1000000$. both numbers are in the range of int but the multiplication is 10^12. which is outside the range of int.Doing long a = 10^6 * 10^6; is also wrong. Why? Because first the multiplication operation is performed than the assignment, hence the temporary answer should be stored somewhere but both the operands are int hence answer will we stored as int which is not enough, therefore it gives you wrong value. See this link for example https://ideone.com/mJDPHQ You can change certain variables to long data type or use 1L while performing some operation(as I did in your code).Hope it helps:) answered 19 Sep '18, 16:12 4★pant0000 111●4 accept rate: 10%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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,424
×304
×241

question asked: 17 Sep '18, 20:11

question was seen: 450 times

last updated: 21 Sep '18, 22:52