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\n");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\n");
}
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;
}
Post author 作者: Grey
Copyright Notice 版权说明: Except where otherwise noted, all content of this blog is licensed under a CC BY-NC-SA 4.0 International license. 除非另有说明,本博客上的所有文章均受 知识共享署名 - 非商业性使用 - 相同方式共享 4.0 国际许可协议 保护。