| 10 | static const unsigned int radix = 1000000000U; |
| 11 | int size() const { return data.size(); } |
| 12 | void init(string n) { |
| 13 | intx res; res.data.clear(); |
| 14 | if (n.empty()) n = "0"; |
| 15 | if (n[0] == '-') res.sign = -1, n = n.substr(1); |
| 16 | for (int i = n.size() - 1; i >= 0; i -= intx::dcnt) { |
| 17 | unsigned int digit = 0; |
| 18 | for (int j = intx::dcnt - 1; j >= 0; j--) { |
| 19 | int idx = i - j; |
| 20 | if (idx < 0) continue; |
| 21 | digit = digit * 10 + (n[idx] - '0'); } |
| 22 | res.data.push_back(digit); } |
| 23 | data = res.data; |
| 24 | normalize(res.sign); } |
| 25 | intx& normalize(int nsign) { |
| 26 | if (data.empty()) data.push_back(0); |
| 27 | for (int i = data.size() - 1; i > 0 && data[i] == 0; i--) |