×

# choosing datatype

 2 L and R are integers 1 ≤ L ≤ R ≤ 10^18, In this case what datatype we can use?? asked 03 Nov '12, 22:07 61●1●2●7 accept rate: 0% 1 Store the numerical inputs(L and R) as a character array and process it!! (13 Nov '12, 23:34) 2 Why? long in Java and long long in C/C++ is ok for those values... (13 Nov '12, 23:36) 1 if it exceeds 10^19? (13 Nov '12, 23:40) 4 the question is: "L, R <= 10^18"... (13 Nov '12, 23:43) 2 Sry for my mistake (13 Nov '12, 23:44)

 1 It depends entirely upon the context in which the problem is given. For example,if the input is very large(10^10000)then you cant take input as integers or long int or long long int(in case of C++) because overflow will occur...In such situation you have to take input as an array of characters..and (if required later on) perform the required manipulation/operation.. In most of the questions..basically input depends upon how you think about the approach/algorithm to a particular problem. answered 09 Nov '12, 15:44 457●2●7●13 accept rate: 0% 1 Also check out the following discussion:http://discuss.codechef.com/questions/3408/large-inputs-in-c It will be more helpful. (09 Nov '12, 15:50)
 -1 use long long int. If you're using scanf/printf for input/output use "%lld" as the control string. answered 03 Nov '12, 23:12 320●4●10 accept rate: 10% 1 lld limit will exceed 10^18 (06 Nov '12, 16:18) 1 Excuse me? You mean that LLD_MAX >= 10^18, right? (06 Nov '12, 16:20) Whats up with the down votes!!:o Am I wrong? (14 Nov '12, 12:26) No you are correct. Added my +1 (14 Nov '12, 12:30)
 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:

×57

question asked: 03 Nov '12, 22:07

question was seen: 1,118 times

last updated: 14 Nov '12, 12:30