#include <iostream>
#include <vector>
#include <initializer_list>
class Matrix {
public:
Matrix(const std::initializer_list<std::initializer_list<double>>&);
void print(const int, const int) const;
private:
const std::vector<std::vector<double>>::size_type d_row;
const std::vector<double>::size_type d_col;
std::vector<std::vector<double>> d_matrix;
};
Matrix::Matrix(const std::initializer_list<std::initializer_list<double>>& list)
: d_row(list.size()), d_col((*list.begin()).size()) {
d_matrix.reserve(d_row);
for (const auto& l : list) {
d_matrix.emplace_back(l);
}
}
void Matrix::print(const int r, const int c) const {
std::cout << d_matrix[r][c] << std::endl;
}
int main() {
Matrix m({ {1, 2, 3},
{3, 4, 2} });
m.print(0, 0);
m.print(0, 1);
m.print(0, 2);
m.print(1, 0);
m.print(1, 1);
m.print(1, 2);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8aW5pdGlhbGl6ZXJfbGlzdD4KCmNsYXNzIE1hdHJpeCB7CnB1YmxpYzoKICAgIE1hdHJpeChjb25zdCBzdGQ6OmluaXRpYWxpemVyX2xpc3Q8c3RkOjppbml0aWFsaXplcl9saXN0PGRvdWJsZT4+Jik7CiAgICB2b2lkIHByaW50KGNvbnN0IGludCwgY29uc3QgaW50KSBjb25zdDsKcHJpdmF0ZToKICAgIGNvbnN0IHN0ZDo6dmVjdG9yPHN0ZDo6dmVjdG9yPGRvdWJsZT4+OjpzaXplX3R5cGUgZF9yb3c7CiAgICBjb25zdCBzdGQ6OnZlY3Rvcjxkb3VibGU+OjpzaXplX3R5cGUgZF9jb2w7CiAgICBzdGQ6OnZlY3RvcjxzdGQ6OnZlY3Rvcjxkb3VibGU+PiBkX21hdHJpeDsKfTsKCk1hdHJpeDo6TWF0cml4KGNvbnN0IHN0ZDo6aW5pdGlhbGl6ZXJfbGlzdDxzdGQ6OmluaXRpYWxpemVyX2xpc3Q8ZG91YmxlPj4mIGxpc3QpCiAgICAgICA6IGRfcm93KGxpc3Quc2l6ZSgpKSwgZF9jb2woKCps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