一维vector
push_back(x):向容器尾部增加一个元素X
例:
vector<int>goal;
goal.push_back(x); //不能用goal[0]=x;因为此时goal[0]还未分配内存
二维vector
vector<vector<int> > nums;
a[N][M];
//a->nums
vector<int > tmp;
for (int i = 0; i < N; ++i) {
tmp.clear();
for (int j = 0; j < M; ++j) {
cin >> a;
tmp.push_back(a);//a[i]->tmp
}
nums.push_back(tmp);//tmp->nums
}