正文
增加 10 行删除 10 行
65 行未改动6667686970717273744 行未改动79808182838485868723 行未改动11111211311411511611711811962 行未改动18218318418518618718818919015 行未改动20620720820921021121221321435 行未改动25025125225325425525625725860 行未改动31932032132232332432532632714 行未改动34234334434534634734834935014 行未改动36536636736836937037137237321 行未改动39539639739839940040140240334 行未改动65 行未改动}inline void DelPre0() {while (len && v[len] == 0) --len;}public:bool is_pos;int v[N], len;//by default, 0 is positive and 0 has length 0.4 行未改动if (!IsZero()) ++len;for (int i = len; i; --i) v[i] = v[i - 1];v[0] = x;}//ConstructorsBigint(): is_pos(1), len(0) {v[0] = 0;}23 行未改动len = a.len;memcpy(v, a.v, (len + 1) * sizeof *v);return *this;}//AddBigint& operator++() { return *this += 1; }Bigint operator++(int) { Bigint tmp(*this); *this += 1; return tmp; }Bigint& operator+=(ll x) {62 行未改动Bigint operator+(const Bigint &a) const {Bigint rst(*this);return rst += a;}//SubtractionBigint& operator--() { return *this += -1; }Bigint operator--(int) { Bigint tmp(*this); *this += -1; return tmp; }Bigint& operator-=(ll x) {15 行未改动Bigint operator-(const Bigint &x) const {Bigint rst(*this), tmp(x); tmp.is_pos ^= 1;return rst += tmp;}//Multiplicationstatic const int FFT_LIM = 5000;Bigint& operator*=(int x) {if (!x) return *this = Bigint();35 行未改动Bigint operator*(const Bigint &x) const {Bigint tmp(*this);return tmp *= x;}//Division & modulo operationBigint& operator/=(int x) {if (IsZero()) return *this;if (x == 0) {60 行未改动Bigint operator%(const Bigint &a) const {Bigint tmp(*this);return tmp %= a;}//Comparebool operator<(const Bigint &a) const {if (is_pos != a.is_pos) return !is_pos;if (len != a.len) return (len < a.len) ^ !is_pos;14 行未改动}bool operator!=(const Bigint &a) const {return (a < *this) || (*this < a);}//Input&Outputstring to_string() const {string ans;if (!is_pos) ans.append(1, '-');14 行未改动}friend ostream& operator<<(ostream &out, const Bigint &a) {return out << a.to_string();}//Othersfriend Bigint abs(const Bigint &a) {Bigint tmp(a);tmp.is_pos = 1;21 行未改动if (!tb.IsZero()) ta = tb;while (tm--) ta *= 2;return ta;}//Debuginline void Debug(string info = "") const {cout << info << endl;printf("Positive? %d\n", is_pos);34 行未改动65 行未改动6667686970717273744 行未改动79808182838485868723 行未改动11111211311411511611711811962 行未改动18218318418518618718818919015 行未改动20620720820921021121221321435 行未改动25025125225325425525625725860 行未改动31932032132232332432532632714 行未改动34234334434534634734834935014 行未改动36536636736836937037137237321 行未改动39539639739839940040140240334 行未改动65 行未改动}inline void DelPre0() {while (len && v[len] == 0) --len;}public:bool is_pos;int v[N], len;//by default, 0 is positive and 0 has length 0.4 行未改动if (!IsZero()) ++len;for (int i = len; i; --i) v[i] = v[i - 1];v[0] = x;}//ConstructorsBigint(): is_pos(1), len(0) {v[0] = 0;}23 行未改动len = a.len;memcpy(v, a.v, (len + 1) * sizeof *v);return *this;}//AddBigint& operator++() { return *this += 1; }Bigint operator++(int) { Bigint tmp(*this); *this += 1; return tmp; }Bigint& operator+=(ll x) {62 行未改动Bigint operator+(const Bigint &a) const {Bigint rst(*this);return rst += a;}//SubtractionBigint& operator--() { return *this += -1; }Bigint operator--(int) { Bigint tmp(*this); *this += -1; return tmp; }Bigint& operator-=(ll x) {15 行未改动Bigint operator-(const Bigint &x) const {Bigint rst(*this), tmp(x); tmp.is_pos ^= 1;return rst += tmp;}//Multiplicationstatic const int FFT_LIM = 5000;Bigint& operator*=(int x) {if (!x) return *this = Bigint();35 行未改动Bigint operator*(const Bigint &x) const {Bigint tmp(*this);return tmp *= x;}//Division & modulo operationBigint& operator/=(int x) {if (IsZero()) return *this;if (x == 0) {60 行未改动Bigint operator%(const Bigint &a) const {Bigint tmp(*this);return tmp %= a;}//Comparebool operator<(const Bigint &a) const {if (is_pos != a.is_pos) return !is_pos;if (len != a.len) return (len < a.len) ^ !is_pos;14 行未改动}bool operator!=(const Bigint &a) const {return (a < *this) || (*this < a);}//Input&Outputstring to_string() const {string ans;if (!is_pos) ans.append(1, '-');14 行未改动}friend ostream& operator<<(ostream &out, const Bigint &a) {return out << a.to_string();}//Othersfriend Bigint abs(const Bigint &a) {Bigint tmp(a);tmp.is_pos = 1;21 行未改动if (!tb.IsZero()) ta = tb;while (tm--) ta *= 2;return ta;}//Debuginline void Debug(string info = "") const {cout << info << endl;printf("Positive? %d\n", is_pos);34 行未改动