#include<map> #include<ctime> #include<cmath> #include<queue> #include<cctype> #include<vector> #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> using namespace std; #define ll long long const int base=10000000; struct big{ ll num[1005]; big(){memset(num,0,sizeof(num));num[0]=1;} void zero(){while(!num[num[0]]&&num[0]>1) num[0]--;} void print(){ printf("%lld",num[num[0]]); for(int i=num[0]-1;i;i--) printf("%07lld",num[i]); putchar(' '); } void leftplus(ll val){ for(int i=++num[0];i>=2;i--) num[i]=num[i-1]; num[1]=val; zero(); } }a,b; ll max(ll a,ll b){return a>=b ? a : b ;} ll min(ll a,ll b){return a<=b ? a : b ;} bool operator < (big x,big y){ if(x.num[0]!=y.num[0]) return x.num[0]<y.num[0]; for(int i=x.num[0];i;i--) if(x.num[i]!=y.num[i]) return x.num[i]<y.num[i]; return false; } bool operator >= (big x,big y){return !(x<y);} bool operator > (big x,big y){return y<x;} bool operator <= (big x,big y){return !(x>y);} bool operator == (big x,big y){ if(x.num[0]!=y.num[0]) return false; for(int i=x.num[0];i;i--) if(x.num[i]!=y.num[i]) return false; return true; } bool operator != (big x,big y){return !(x==y);} big operator + (big x,ll val){ x.num[1]+=val; for(int i=1;i<=x.num[i];i++) if(x.num[i]>=base){ x.num[i+1]+=x.num[i]/base; x.num[i]%=base; if(i+1>x.num[0]) x.num[0]=i+1; } else break; return x; } big operator + (ll val,big x){return x+val;} big operator - (big x,ll val){ x.num[1]-=val; for(int i=1;i<=x.num[0];i++) if(x.num[i]<0){ ll now=x.num[i]%base+base; x.num[i+1]-=(now-x.num[i])/base; x.num[i]=now; } else break; x.zero(); return x; } big operator * (big x,ll val){ for(int i=1;i<=x.num[0];i++) x.num[i]*=val; for(int i=1;i<=x.num[0];i++) if(x.num[i]>=base){ x.num[i+1]+=x.num[i]/base; x.num[i]%=base; if(i+1>x.num[0]) x.num[0]=i+1; } return x; } big operator * (ll val,big x){return x*val;} big operator / (big x,ll val){ ll sum=0; for(int i=x.num[0];i;i--){ sum=sum*base+x.num[i]; if(sum<val) continue; x.num[i]=sum/val; sum=sum-val*x.num[i]; } x.zero(); return x; } big operator + (big x,big y){ x.num[0]=max(x.num[0],y.num[0]); for(int i=1;i<=x.num[0];i++) x.num[i]+=y.num[i]; for(int i=1;i<=x.num[0];i++) if(x.num[i]>=base){ x.num[i+1]+=x.num[i]/base; x.num[i]%=base; if(i+1>x.num[0]) x.num[0]=i+1; } return x; } big operator - (big x,big y){ for(int i=x.num[0];i>=1;i--) x.num[i]=x.num[i]-y.num[i]; for(int i=1;i<=x.num[0];i++) if(x.num[i]<0){ x.num[i]+=base; x.num[i+1]--; } x.zero(); return x; } big operator * (big x,big y){ big z; z.num[0]=x.num[0]+y.num[0]; for(int i=1;i<=x.num[0];i++) for(int j=1;j<=y.num[0];j++) z.num[i+j-1]+=x.num[i]*y.num[i]; for(int i=1;i<=z.num[0];i++) if(z.num[i]>=base){ z.num[i+1]+=z.num[i]/base; z.num[i]%=base; } z.zero(); return z; } big operator / (big x,big y){ big z,sum; z.num[0]=x.num[0]; for(int i=x.num[0];i;i--){ sum.leftplus(x.num[i]); sum.print(); if(sum<y) continue; ll l=0,r=base,mid,ans; while(l<=r){ mid=(l+r)>>1; if(y*mid<=sum) l=mid+1,ans=mid; else r=mid-1; } z.num[i]=ans,sum=sum-y*ans; } z.zero(); return z; } int main(){ return 0; }