如果你用__int64,也就是long long ,是通过不了高精A+B的
今天,我们拿出__
i
n
t
128
int128
int128,尝试下能否通过。
首先 int128不能用正常的输入输出,必须要介样
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 write(__int128 x)//输出
{
if(x<0)
{
putchar('-');
x=-x;
}
if(x>9)
write(x/10);
putchar(x%10+'0');
}
然后作死代码就来了
#include <bits/stdc++.h>
using namespace std;
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 write(__int128 x)
{
if(x<0)
{
putchar('-');
x=-x;
}
if(x>9)
write(x/10);
putchar(x%10+'0');
}
int main()
{
__int128 a=read();
__int128 b=read();
write(a+b);
return 0;
}
运行一下!!
于是我傻傻的打开了洛谷
留个彩蛋
刮刮乐
爸爸!
\boxed{\color{green}\colorbox{green}{\texttt{爸爸!}}}
爸爸!
再吃!
\boxed{\color{red}\colorbox{red}{\texttt{再吃!}}}
再吃!
塞班!
\boxed{\color{blue}\colorbox{blue}{\texttt{塞班!}}}
塞班!