huangyecheng • 2年前
using namespace std; template void debugVector(const T &a) {
cout << "[ ";
for (size_t i = 0; i < a.size(); ++i) {
cout << a[i] << (i == a.size() - 1 ? " " : ", ");
}
cout << "]" << endl;
}
template void debugMatrix2(const T &a) {
for (size_t i = 0; i < a.size(); ++i) {
debugVector(a[i]);
}
}
template using matrix2 = vector<vector>;
template vector<vector> getMatrix2(size_t n, size_t m, T init = T()) {
return vector<vector<T>>(n, vector<T>(m, init));
}
template using matrix3 = vector<vector<vector>>;
template vector<vector<vector>> getMatrix3(size_t x, size_t y, size_t z, T init = T()) {
return vector<vector<vector<T>>>(x, vector<vector<T>>(y, vector<T>(z, init)));
}
vector genBigInteger(string a) {
vector<int> res;
for (int i = a.size() - 1; i >= 0; --i) {
res.push_back(a[i] - '0');
}
return res;
}
void printBigInteger(vector a) {
for (size_t i = a.size() - 1; i >= 0; --i) {
cout << a[i];
}
}
vector addBigInteger(vector a, vector b) {
vector<int> res;
int pre = 0;
for (size_t i = 0; i < a.size() || i < b.size() || pre; ++i) {
if (i < a.size()) pre += a[i];
if (i < b.size()) pre += b[i];
res.push_back(pre % 10);
pre /= 10;
}
return res;
}
int main() {
cout <<"turn off the light.turn off the light.turn off the light." <<endl;
return 0;
}
评论: