| 162 | } |
| 163 | |
| 164 | void __sub(const BigInt& v) { |
| 165 | for (int i = 0, carry = 0; i < (int) v.a.size() || carry; ++i) { |
| 166 | a[i] -= carry + (i < (int) v.a.size() ? v.a[i] : 0); |
| 167 | carry = a[i] < 0; |
| 168 | if (carry) a[i] += BASE; |
| 169 | } |
| 170 | this->trim(); |
| 171 | } |
| 172 | |
| 173 | BigInt operator+=(const BigInt& v) { |
| 174 | if (sgn == v.sgn) __add(v); |