typedef long long LL;
struct bign
{
static const int WIDTH=4;
static const int BASE=10000;
int len;
int z[1010];
bign()
{
len=1;
memset(z,0,sizeof(z));
}
bign(LL x)
{
*this=x;
}
bign operator=(LL x)//可以强制类型转换
{
bign c;
int len=0;
do{
c.z[len++]=x%BASE;
x/=BASE;
}while(x);
while(len>1 && c.z[len-1]==0)len--;
c.len=len;
return *this=c;
}
bign operator=(char *s)//这是我能想出来最快的方法了
{
bign c;
int len=0,t,lens=strlen(s);
for(int i=lens-1;i>=0;i-=WIDTH)
{
t=0;
for(int j=max(i-WIDTH+1,0);j<=i;j++)
t=t*10+(s[j]^48);
c.z[len++]=t;
}
while(len>1 && c.z[len-1]==0)len--;
c.len=
板子:压位高精度
最新推荐文章于 2023-01-04 19:30:00 发布