27 August

高精度

struct bigint{
	int a[1000],an;
	bigint operator = (int b){
		an=0;
		while (b){a[an++]=b%10;b/=10;}
		return *this;
	}
	bigint operator *= (long long b){
		long long c=0,temp=0;
		for (int i=0;i<min(an,50);i++){
			temp=(a[i]*b+c);
			a[i]=temp%10;
			c=temp/10;
		}
		while (c&&an<=50) {a[an++]=c%10;c/=10;}
		return *this;
	}
};
void write(bigint x){
	if(x.an==0){printf("0
");return;}
	bool qz=true;
	for (int i=min(x.an-1,49);i>=0;i--){
		if (qz&&x.a[i]==0);
		else {qz=false; printf("%d",x.a[i]);}
	}
	if (qz) printf("0
");
}
int read(){
	int out=0;
	char cc=getchar();
	while (cc>'9'||cc<'0') cc=getchar();
	while (cc>='0'&&cc<='9'){out=out*10+cc-'0';cc=getchar();}
	return out;
}
原文地址:https://www.cnblogs.com/greyqz/p/11420777.html