__int128
在很多題目裏面要求高精度,但是這種高精度又不是那種非常大的,可能比unsigned longlong
大,所以這個時候去寫高精度模板非常不划算,用__int128代替就非常不錯;
但是__int128對cin,cout,print,scanf都不支持,要另寫輸入輸出;
模板:
inline __int128 read(){//輸入模板
__int128 x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
inline void print(__int128 x){//輸出模板
if(x<0){
putchar('-');
x=-x;
}
if(x>9) print(x/10);
putchar(x%10+'0');
}
定義這個完了以後,直接讀入輸出就可以了;