I know that The maximum value for a variable of type unsigned long long
in C++ is:
18,446,744,073,709,551,615
but I don't know that how can I set value of a variable to an amount that is more than 18,446,744,073,709,551,615?
I know that The maximum value for a variable of type unsigned long long
in C++ is:
18,446,744,073,709,551,615
but I don't know that how can I set value of a variable to an amount that is more than 18,446,744,073,709,551,615?
In vanilla C++ you can't, however, you can use Boost's multi-precision library.
maybe you can use __int128
,the only problem is that you can't use cin
,cout
or printf
but you can write a function like that:
//output
inline void write(__int128 x)
{
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
//input
inline __int128 read()
{
__int128 X=0,w=0; char ch=0;
while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
while(isdigit(ch)) X=x*10+(ch-'0'),ch=getchar();
return w?-X:X;
}