usingnamespacestd; typedefpair<int, int> PII; typedeflonglong LL; constint N = 1010;
int n; PII T[N]; LL S[N], maxn; // 692 // i=2、1、0
vector<int> mul(vector<int> a, int b) { int t = 0; vector<int> c; for(int i = 0; i < a.size(); i++) { t += a[i] * b; c.push_back(t % 10); t /= 10; } while(t) c.push_back(t % 10), t /= 10; return c; }
vector<int> div(vector<int> a, int b) { int t = 0; vector<int> c; bool is_0 = false; for(int i = a.size() - 1; i >= 0; i--) { t = t * 10 + a[i]; int x = t / b; // x 不为0 或前导不是0 if(x || is_0) { is_0 = true; c.push_back(x); } t %= b; } reverse(c.begin(), c.end()); return c; }
vector<int> max_vec(vector<int> a, vector<int> b) { if(a.size() > b.size()) return a; if(a.size() < b.size()) return b;