只含加减乘,<,(leq),勉强能用,低精构造即可。
namespace clockwhite{
const int MLen=1001,P=10000;
char ch[MLen<<2];
struct Big{
int S[MLen];
bool fu;
inline void init(){memset(S,0,sizeof(S));S[0]=0;fu=0;}
int& operator [](int k){return S[k];}
Big(){init();}
Big(int k){
init();
if(k<0)fu=1,k=-k;else fu=0;
while(k)S[++S[0]]=k%P,k/=P;
if(!S[0])S[0]=1;
}
bool operator < (Big b){
bool res=0;
if(fu^b.fu)return fu;
if(fu&&b.fu)res=1;
if(S[0]!=b[0])return (S[0]<b[0])^res;
for(int i=S[0];i;--i)
if(S[i]!=b[i])return (S[i]<b[i])^res;
return false;
}
bool operator == (Big b){
if(fu!=b.fu||S[0]!=b[0])return 0;
for(int i=S[0];i;--i)if(S[i]!=b[i])return 0;
return 1;
}
bool operator <= (Big b){return *this<b||*this==b;}
bool operator != (Big b){return !(*this==b);}
Big operator + (Big b)const{
Big a=*this,ans;ans.init();
if(a.fu&&b.fu){
a.fu=b.fu=0;ans=a+b;
if(ans[1]!=0||ans[0]!=1)ans.fu=1;
return ans;
}
if(a.fu&&!b.fu){a.fu=0;return b-a;}
if(!a.fu&&b.fu){b.fu=0;return a-b;}
a[0]=max(a[0],b[0]);
for(int i=1;i<=a[0];++i)a[i+1]+=(a[i]+b[i])/P,a[i]=(a[i]+b[i])%P;
if(a[a[0]+1])++a[0];
return a;
}
Big operator -(Big b)const{
Big ans,a=*this;ans.init();
if(a.fu&&!b.fu){
a.fu=b.fu=0;ans=a+b;
if(ans[1]!=0||ans[0]!=1)ans.fu=1;
return ans;
}
if(a.fu&&b.fu){a.fu=b.fu=0;return b-a;}
if(!a.fu&&b.fu){b.fu=0;return a+b;}
if(a<b)swap(a,b),a.fu=1;
else a.fu=0;
for(int i=1;i<=a[0];++i){
if(a[i]<b[i])a[i]+=P,--a[i+1];
a[i]-=b[i];
}
while(!a[a[0]]&&a[0]>1)--a[0];
if(a[0]==1&&a[1]==0)a.fu=0;
return a;
}
Big operator * (Big b)const{
Big ans,a=*this;ans.init();
ans[0]=a[0]+b[0]-1;
for(int i=1;i<=a[0];++i)
for(int j=1;j<=b[0];++j){
ans[i+j-1]+=a[i]*b[j];
ans[i+j]+=ans[i+j-1]/P;
ans[i+j-1]%=P;
}
if(ans[ans[0]+1])++ans[0];
while(!ans[ans[0]]&&ans[0]>1)--ans[0];
ans.fu=a.fu^b.fu;
if(ans[0]==1&&ans[1]==0)ans.fu=0;
return ans;
}
inline void sc(){
scanf("%s",ch);init();S[0]=1;
int pow=1,t=1,len=strlen(ch),stop=0;
if(ch[0]=='-')fu=1,stop=1;
for(int i=len-1;i>=stop;--i){
if(t>4)t=pow=1,++S[0];
S[S[0]]+=pow*(ch[i]-'0');
++t,pow=(pow<<3)+(pow<<1);
}
}
inline void pr(){
if(fu)printf("-");
printf("%d",S[S[0]]);
for(int i=S[0]-1;i;--i){
if(S[i]<10)putchar('0');
if(S[i]<100)putchar('0');
if(S[i]<1000)putchar('0');
printf("%d",S[i]);
}
}
};
}