#Snow{ position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999; background: rgba(255,255,240,0.1); pointer-events: none; }

___int128

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


存储范围

  • 顾名思义, __int128 就是占用128字节的整数存储类型。由于是二进制,范围就是 −2127 ~ 2127−1,如果使用了 unsigned __int128,则范围变成 0 ~ 2128,即约39位数!

食用方法

#include<bits/stdc++.h>
using namespace std;
__int128 a;
void init(__int128 &x)
{
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') f=-1;ch=getchar();	
	}	
	while(isdigit(ch))
	{
		x=x*10+ch-48;ch=getchar();
	}
	x*=f;
} 
void print(__int128 x)
{
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	if(x>9) print(x/10);
	putchar(x%10+'0');
}
int main(){
	init(a);
	print(a);
	return 0;
}
posted @   繁花孤城  阅读(639)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示