Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在做作业,我看到了这个向量声明。我试图在谷歌上找到,但仍然无法理解。这里是:
vector<vector<int>>res = vector<vector<int>>(n,vector<int>(n,0));
我知道vector<vector<int>>意味着 2D 矢量,但我不明白这之后的部分= vector<vector<int>>(n,vector<int>(n,0));
vector<vector<int>>
= vector<vector<int>>(n,vector<int>(n,0));
你也可以这样写:
vector<vector<int>>res(n,vector<int>(n,0));
这意味着您有 nvector<int>其中每个都有n初始化为 的元素0。
vector<int>
n
0