| 82 | borrow = borrow < 0 ? 1 : 0; } |
| 83 | return c.normalize(sign); } |
| 84 | intx operator *(const intx& b) const { |
| 85 | intx c; c.data.assign(size() + b.size() + 1, 0); |
| 86 | rep(i,0,size()) { |
| 87 | long long carry = 0; |
| 88 | for (int j = 0; j < b.size() || carry; j++) { |
| 89 | if (j < b.size()) |
| 90 | carry += (long long)data[i] * b.data[j]; |
| 91 | carry += c.data[i + j]; |
| 92 | c.data[i + j] = carry % intx::radix; |
| 93 | carry /= intx::radix; } } |
| 94 | return c.normalize(sign * b.sign); } |
| 95 | friend pair<intx,intx> divmod(const intx& n, const intx& d) { |
| 96 | assert(!(d.size() == 1 && d.data[0] == 0)); |
| 97 | intx q, r; q.data.assign(n.size(), 0); |