首页 > 技术文章 > 关于 __int128

29taorz 2021-08-22 19:37 原文

关于 __int128

不会有人像我一样只打了一个_爆零吧

是__int128不是_int128!!!

介绍

__int128在g++里是过不了编译的所以要调试用了__int128的代码建议直接用luogu的IDE

__int128顾名思义是一个范围能达到-2^127-1~2^127-1的整型变量,当然还有unsigned __int128 0~2^128-1。

使用方法

除了读入&输出

与普通整形变量无异

__int128 n; n=m; n++; n*=m;

读入&输出

__int128 需要使用快读快输的技巧来读入输出,cin cout和scanf printf都奈何不了它。

inline void input(__int128 &s)
{
    s=0;
    char c=' ';
    while(c>'9'||c<'0') c=getchar();
    while(c>='0'&&c<='9')
    {
        s=s*10+c-'0';
        c=getchar();
    }
}

void out(int x)
{
if(!x)return;
  out(x/10);
  putchar(x%10+'0');
}
 

 

推荐阅读