正文
增加 29 行删除 18 行
1234567891011121314151620 行未改动37383940414243444546474849505152535455565758596061626364656614 行未改动81828384858687888926 行未改动11611711811912012112212312447 行未改动172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216```cpp#define ll long longstruct BigInt{ll value[12501];int p;BigInt(){p=1;for(int i=1;i<12501;++i) value[i]=0;}void GiveValue(string s){reverse(s.begin(),s.end());int len=s.size();p=0;20 行未改动cin>>s;GiveValue(s);}void Print(){if(value[1]==0&&p==1){cout<<"0";return;}if(value[0]==1) cout<<'-';for(int i=p;i>=1;--i){if(i!=p&&value[i]<10000000) cout<<setfill('0')<<setw(8);cout<<value[i];}}int CompareWith(BigInt b){if(value[0]!=b.value[0]) return value[0]?0:2;if(p!=b.p) return p>b.p?2:0;for(int i=p;i>=1;--i) {if(value[i]>b.value[i]) return 2;if(value[i]<b.value[i]) return 0;}return 1;}int CompareWith(ll b){BigInt tmp;tmp.GiveValue(b);return CompareWith(tmp);14 行未改动}if(carry) value[++max_p]=carry;p=max_p;}void Add(ll b){BigInt tmp;tmp.GiveValue(b);Add(tmp);26 行未改动BigInt tmp;tmp.GiveValue(b);Subtract(tmp);}void Multiply(BigInt b){BigInt res;res.p=p+b.p;for(int i=1;i<=p;++i){47 行未改动Divide(tmp);}};BigInt Add(BigInt a,BigInt b){a.Add(b);return a;}BigInt Add(BigInt a,ll b){a.Add(b);return a;}BigInt Subtract(BigInt a,BigInt b){a.Subtract(b);return a;}BigInt Subtract(BigInt a,ll b){a.Subtract(b);return a;}BigInt Multiply(BigInt a,BigInt b){a.Multiply(b);return a;}BigInt Multiply(BigInt a,ll b){a.Multiply(b);return a;}BigInt Divide(BigInt a,BigInt b){a.Divide(b);return a;}BigInt Divide(BigInt a,ll b){a.Divide(b);return a;}```~妈妈再也不用担心孩子不会高精度了!~1234567891011121314151620 行未改动373839404142434445464748495051525354555657585960616263646566676814 行未改动83848586878889909126 行未改动11811912012112212312412512647 行未改动174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227```cpp#define ll long longstruct BigInt{ll value[12501];int p;BigInt(){p=1;for(int i=1;i<12501;++i) value[i]=0;}void GiveValue(string s){reverse(s.begin(),s.end());int len=s.size();p=0;20 行未改动cin>>s;GiveValue(s);}void Print(string s){if(value[1]==0&&p==1){cout<<"0";cout<<s;return;}if(value[0]==1) cout<<'-';for(int i=p;i>=1;--i){if(i!=p&&value[i]<10000000) cout<<setfill('0')<<setw(8);cout<<value[i];}cout<<s;}int CompareWith(BigInt b){if(value[0]!=b.value[0]) return value[0]?0:2;if(p!=b.p) return p>b.p?2:0;for(int i=p;i>=1;--i) {if(value[i]>b.value[i]) return 2;if(value[i]<b.value[i]) return 0;}return 1;}int CompareWith(ll b){BigInt tmp;tmp.GiveValue(b);return CompareWith(tmp);14 行未改动}if(carry) value[++max_p]=carry;p=max_p;}void Add(ll b){BigInt tmp;tmp.GiveValue(b);Add(tmp);26 行未改动BigInt tmp;tmp.GiveValue(b);Subtract(tmp);}void Multiply(BigInt b){BigInt res;res.p=p+b.p;for(int i=1;i<=p;++i){47 行未改动Divide(tmp);}};BigInt operator +(BigInt a,BigInt b){a.Add(b);return a;}BigInt operator +(BigInt a,ll b){a.Add(b);return a;}BigInt operator -(BigInt a,BigInt b){a.Subtract(b);return a;}BigInt operator -(BigInt a,ll b){a.Subtract(b);return a;}BigInt operator *(BigInt a,BigInt b){a.Multiply(b);return a;}BigInt operator *(BigInt a,ll b){a.Multiply(b);return a;}BigInt operator /(BigInt a,BigInt b){a.Divide(b);return a;}BigInt operator /(BigInt a,ll b){a.Divide(b);return a;}BigInt operator %(BigInt a,BigInt b){BigInt c=a/b;return a-b*c;}BigInt operator %(BigInt a,ll b){BigInt c=a/b;return a-c*b;}```