0
点赞
收藏
分享

微信扫一扫

int128的使用

眼君 2022-04-16 阅读 50
c++

转自这里
输入输出模板

#include <iostream>

using namespace std;

typedef __int128_t int128;

int128 read(){
    int128 x=0;bool f=0;char c=getchar();
    while (c<'0'||c>'9'){if (c=='-')f=1;c=getchar();}
    while (c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
    return f?-x:x;
}

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);
}

举报

相关推荐

0 条评论