Operation on Huge numbers in C++

In C++ / C we can’t work with very large numbers like 10^100 ,But in some cases we need to work with such large numbers specially for solving some problems…
I searched net and from my own idea I think I can do this by storing all digits in an array and use laws of number theory to do many operations like addition,multiplication and output as string…
But are there other effective ways to do this faster like any library or STL in C++ or C to work with such huge numbers because in live competitions it’s really needed to code faster and this way takes lots of memory.
Or,Is there any algorithms or technique to do any operation s on large numbers quicker and good way…
Please if you know any links or sites mention.
I ll appreciate any help.
Thanks :slight_smile:

if u see the top submissions in c/c++ of the problem…http://www.codechef.com/problems/FCTRL2 …then u’ll find that no such stl(if it exists)is being used…just arrays and laws of number theory…if u want to code fast with large numbers( >10 ^ 19) then u can use a diff lang like python(int can store large vals arnd 200!) or maybe java(BigInteger)…hope this helps…:slight_smile:


Thanks,Actually though I know Java and Python I don’t use them for solving problems (I am in C++ for more than other ones)…
But one thing was bothering me -> how to work with modulus for large numbers
Like I have a 100 digit number and another 30 digit number …I need to find out first number % 2nd number in C++
I aint sure how to do that…
And I saw the FCTRL2 tutorial before
Thanks by the way :slight_smile: