跳到正文

算法·理论

【模板】__int128输入输出

xxxasybt2023约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟

版本

  1. v1当前
C++
typedef __int128 lllong;
istream& operator>>(istream& in,lllong& __a)
{
    short __f = 1;lllong __num = 0;char __c = getchar();
	while((__c<'0'||__c>'9') && __c!='-') __c = getchar();
	if(__c == '-') __f = -1;
	while(__c>='0' && __c<='9')
		__num = __num*10+__c-'0',__c = getchar();
	__a = __num*__f;
    return in;
}
void __write(lllong __a)
{
    if (!__a) return ;
    __write(__a/10);
    putchar(__a%10+'0');
}
ostream& operator<<(ostream& out,lllong __a)
{
    if (!__a) putchar('0');
    else __write(__a);
    return out;
}
原文