数据范围1e36,Linux系统才能用,要使用快读输入输出(cin/cout貌似也行)
可以#define int __int128
输入:
inline __int128 in128()
{
__int128 res=0,p=1;
char c=getchar();
while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
while(c>='0'&&c<='9') {res=res*10+c-48; c=getchar();}
return p*res;
}
可以判EOF的输入:
inline ll in()
{
ll res=0,p=1;
int t = getchar();
if (t == EOF) return 666666;
char c=(char)t;
while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
return p*res;
}
输出:
void out128(__int128 x)
{
if (x>9) out128(x/10);
putchar(x%10+48);
}
void outn128(__int128 x)
{
if (x<0){
putchar('-');
out(-x);
}else out(x);
putchar(10);
}