据说,__int128只能在linux环境下才能编译成功,不过大多数OJ都是用linux为后台,所以掌握__int128还是很重要的。

__int128的输入输出模板:

#include<iostream>
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 << 1) + (x << 3) + (ch - '0');
        ch = getchar();
    }
    return x * f;
}
void print(__int128 x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x > 9)
        print(x / 10);
    putchar(x % 10 + '0');
}
int main()
{
    __int128 x = read();
    print(x);
    return 0;
}