版本比较
高精度结构体
正文
增加 8 行删除 8 行
12344567789101112121314151633 行未改动50515253545455565758596061626364646566676814 行未改动8384858687878889909126 行未改动11811912012112212212312412512666 行未改动19319419519619719719819920020126 行未改动```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;33 行未改动 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){66 行未改动BigInt operator -(BigInt a,ll b){ a.Subtract(b); return a;}
BigInt operator *(BigInt a,BigInt b){ a.Multiply(b); return a;}26 行未改动