关于__int128

___int128是一种超长整数类型,支持 -2^{127} ~2^{127}-1 这么大。
可以直接进行四则运算,但是不出现在MSVC、编译器(VS不能用),GCC和G++可以
定义

#include <bits/stdc++.h>
using namespace std;

int main()
{
    __int128 a;
    return 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 print(__int128 x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x > 9)
        print(x / 10);
    putchar(x % 10 + '0');
}
int main()
{
    __int128 a = read();
    __int128 b = read();
    print(a + b);
    return 0;
}

read是输入函数
print是输出函数
注意事项:__int128必须使用快读快些(这个就已经劝退不少人力)

5 个赞

疑问:快读快写为什么劝退很多人,不就是板子吗?

4 个赞

盲猜™别不下来

4 个赞

板子是板子,是怎么也进不了脑子的

我甚至连头文件都没背下来~~ :rofl: :rofl: :rofl:

4 个赞

我不信,你这骗人吧?

4 个赞

包真的呀~~~

5 个赞