__int 128,不能使用普通的cin,cout,输入,输出,需要自己写一个输入输出的模板

#include <bits/stdc++.h>

using namespace std;
 
void scan(__int128 &x)//输入
{
    x = 0;
    int f = 1;
    char ch;
    if((ch = getchar()) == '-') f = -f;
    else x = x*10 + ch-'0';
    while((ch = getchar()) >= '0' && ch <= '9')
        x = x*10 + ch-'0';
    x *= f;
}
void _print(__int128 x)//输出正数
{
    if(x > 9) _print(x/10);
    putchar(x%10 + '0');
}
void print(__int128 x)//输出输出负数
{
    if(x < 0)
    {
        x = -x;
        putchar('-');
    }
    _print(x);
}
int main()
{
    __int128 a, b;
    scan(a); scan(b);
    print(a + b);
    return 0;
}

模板题

代码:

#include <bits/stdc++.h>

using namespace std;
 
void scan(__int128 &x)//输入
{
    x = 0;
    int f = 1;
    char ch;
    if((ch = getchar()) == '-') f = -f;
    else x = x*10 + ch-'0';
    while((ch = getchar()) >= '0' && ch <= '9')
        x = x*10 + ch-'0';
    x *= f;
}
void _print(__int128 x)
{
    if(x > 9) _print(x/10);
    putchar(x%10 + '0');
}
void print(__int128 x)//输出
{
    if(x < 0)
    {
        x = -x;
        putchar('-');
    }
    _print(x);
}
int main()
{
    __int128 a, b,c;
    scan(a); scan(b);scan(c);
    print(a + b+c);
    return 0;
}