intmain() { for (int i = 0; i < 100; i++) { ID.push_back(vector<int>()); } cin >> N >> M; for (int i = 0; i < M; i++) { int id, k; cin >> id; cin >> k;//有几个子节点 for (int j = 0; j < k; j++) { int id2; cin >> id2; ID[id].push_back(id2);
}//end for j
}//end for i
q.push(1); while (!q.empty()) { int size = q.size(); int count; for (int i = 0; i < size; i++) { int top = q.front(); q.pop(); if (ID[top].size() == 0)//无孩子,叶子节点 { count++; } else { for (int j = 0; j < ID[top].size(); j++) { q.push(ID[top][j]); } } v.push_back(count); } } cout << v[0]; for (int i = 1; i < v.size(); i++) { cout << " " << v[i]; }
Please check the post_relate setting in config.yml of hexo-theme-Annie! You should make sure 'postsEnable == true' and the number of site posts greater than 1.
Please check the comment setting in config.yml of hexo-theme-Annie!