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

转载于:https://www.cnblogs.com/greyqz/p/11420777.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值