...
和,差,商,积:sum, diff, quot(ient), prod(uct)
邻接数组形式的bfs模板:
代码块 |
---|
vector<int> visited;
void bfs(vector<vector<int>> &graph, int start) {
queue<int> q;
q.push(start);
visited[start] = 1;
while(!q.empty()) {
int size = q.size();
while(size-- > 0) {
int cur = q.front(); q.pop();
visited[cur] = 1;
for(auto nxt : graph[n]) {
if(!visited[nxt]) {
q.push(nxt);
visited[nxt] = 1;
}
}
}
}
} |