×

# What is the range of int?

 0 Should int be able to hold <10^9 values? Int ranges from –2,147,483,648 to 2,147,483,647. I was solving a question but i got WA and then i got AC after changing all int's to long long int. Can't discuss the specific problem as it is in ongoing contest. What i mean to ask is whether codechef's compiler has less range of an int. asked 12 Jul '14, 22:50 3★tacoder 517●4●6●15 accept rate: 18%

 0 This is the correct range in 32 bit. The problem might be with the some intermediate result causing overflow. answered 12 Jul '14, 23:04 1.8k●4●9●32 accept rate: 14% Codechef compiler also works on 32 bit? The weird thing is i don't do any operations on the integers in the code. Guess i'll have to wait for contest to end so i can post my solution code as well. (12 Jul '14, 23:39) tacoder3★ Correct. Who down-voted this!? (13 Jul '14, 15:43)
 0 The problem might have been caused maybe because you were performing an operation like m=(n*n-1)/2 In this case though both n and n-1 are in int range but teh value of m might exceed the int range and hence result in wa due to overflow! answered 12 Jul '14, 23:35 288●2●4●11 accept rate: 6% As i said, i don't do any operations on the integers, so overflow is not a possibility (13 Jul '14, 15:25) tacoder3★ Correct. Post the problem and your solution, if there was a WA due to overflow calculations might be a culprit, else the reason is not overflow but something else. (13 Jul '14, 15:43)
 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:

×58
×25

question asked: 12 Jul '14, 22:50

question was seen: 6,215 times

last updated: 13 Jul '14, 15:43