How to deal with large values in C++

can anybody tell me how to deal with large values in c++ that even unsigned long long int can’t handle because, if i code for the same problem with same logic and algorithm in python it somehow runs most of the times.

I normally use a string to operate on very large values. You can read this article for more details.

no but if i have to do computations with these values or after some sort of computations you are getting these large values as a result then ?

search Boost libraries in C++. You will get your answer. :slight_smile:

but it is more necessary that online judges supports boost libraries or not.

they support. :slight_smile: go for it

If you really need it, you can use a bigint class written by yourself or someone else like this. Most of the times, the problems can be solved without using such large numbers.

1 Like

This kind of problems are rare.
But If you really require it use array/string.
Simulate the process which we learned in school.

see this question and code…
https://www.codechef.com/viewsolution/28954228

Libraries use better algorithm for multiplication like karatsuba algo

1 Like