choosing datatype

data

#1

L and R are integers 1 ? L ? R ? 10^18, In this case what datatype we can use??


#2

use long long int.

If you’re using scanf/printf for input/output use “%lld” as the control string.


#3

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.


#4

lld limit will exceed 10^18


#5

Excuse me? You mean that LLD_MAX >= 10^18, right?


#6

Also check out the following discussion:
http://discuss.codechef.com/questions/3408/large-inputs-in-c

It will be more helpful.


#7

Store the numerical inputs(L and R) as a character array and process it!!


#8

Why? long in Java and long long in C/C++ is ok for those values…


#9

if it exceeds 10^19?


#10

the question is: “L, R <= 10^18”…


#11

Sry for my mistake


#12

Whats up with the down votes!!:o Am I wrong?


#13

No you are correct. Added my +1