int128

· · 个人记录

__int128

重中之重:NOIP能用(也不用写高精了)(还是要看情况的,毕竟1e38还是太弱小了)

如果遇到 long long 开不下的情况,可以使用 int128 来博一把!note :int128 仅 64 位 GCCG++ 支持,不在 C++ 标准中!不在 namespace std 中!64 位 GCC 可直接使用。

存储范围:-1e38~1e38

#include<bits/stdc++.h>
using namespace std;
__int128 read()
{
    __int128 x=0;int f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+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 a=read(),b=read();
    __int128 c=a+b;
    print(c);
    return 0;
}