__int128的使用
__int128这种东西好像标准c++库里面没有……所以读入输出只能自己写了
大概仿照一下快速读入之类的写法即可了。
#include <bits/stdc++.h>
using namespace std;
void scan(__int128 &x)//输入
{
x=0;int f=1;char ch=getchar();
while (!isdigit(ch)){if (ch=='-')f=-1;ch=getchar();}
while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
x*=f;
}
void _print(__int128 x)
{
if(x>9) _print(x/10);
putchar(x%10 + '0');
}
void print(__int128 x)//输出
{
if(x<0)
{
x=-x;
putchar('-');
}
_print(x);
}
如果有人要吐槽你这写的什么jb输入输出啊(,那么我又写了一份应该是更好的给大家:
char ibuf[1000050],*s=ibuf;
inline __int128 read128()
{
__int128 x=0;
int f=1;
while (*s<48)
{
if (*s==45)
f=-1;
s++;
}
while (*s>32)
x=x*10+*s++-48;
return x*f;
}
char ouf[1000050],*t=ouf,res[40];
inline void output128(__int128 x)
{
static char *s=res;
if (!x)
*t++='0';
else
{
while (x>0)
{
*s++=x%10+48;
x/=10;
}
while (s!=res)
*t++=*--s;
}
}
//程序开始之前fread(s=ibuf,1,1000050,stdin);
//程序结束之前要fwrite(ouf,1,t-ouf,stdout);