1004 Counting Leaves
更多...
|
int | main (istream &cin, ostream &cout) |
|
| TEST (a1004, case1) |
|
◆ main()
int pat::a::a1004::main |
( |
istream & |
cin, |
|
|
ostream & |
cout |
|
) |
| |
在文件 pat.cpp 第 4016 行定义.
4023 unordered_map<string, node *> um;
4024 for(
int i = 0; i < m; i++) {
4028 if(!um.contains(
id)) {
4029 um[id] =
new node(
id);
4031 auto *
const nd = um[id];
4032 for(
int j = 0; j < k; j++) {
4035 if(!um.contains(cid)) {
4036 um[cid] =
new node(cid);
4038 nd->children.insert(um[cid]);
4041 queue<pair<node *, int>> q;
4042 q.push(make_pair(um[
"01"], 0));
4043 if(um[
"01"] ==
nullptr) {
4047 int current_level = 0;
4050 auto [nd, level] = q.front();
4052 if(level != current_level) {
4053 if(current_level != 0) {
4056 current_level = level;
4060 if(nd->children.empty()) {
4063 for(
auto *c: nd->children) {
4064 q.push(make_pair(c, level + 1));
4067 cout <<
' ' << leaf_cnt;
被这些函数引用 TEST().
◆ TEST()
pat::a::a1004::TEST |
( |
a1004 |
, |
|
|
case1 |
|
|
) |
| |
在文件 pat_test.cpp 第 1984 行定义.
1985 istringstream in(
"2 1\n"
1987 auto out = ostringstream();
1989 ASSERT_EQ(
"0 1", out.str());
int main(int argc, char **argv)
引用了 main().