添加了初始化 log, 修复了第一个小人的 id 不对的问题
This commit is contained in:
parent
4ab54cbc2c
commit
0b60204e6b
@ -50,16 +50,18 @@ int main () {
|
||||
}
|
||||
|
||||
node* first = new node;
|
||||
(*first).id = 0;
|
||||
(*first).id = 1;
|
||||
(*first).prev = first;
|
||||
(*first).next = first;
|
||||
int count = 1;
|
||||
std::cout << "招募了小人 #" << 1 << " ." << std::endl;
|
||||
|
||||
for (int i = 2; i <= n; i++) {
|
||||
node* curr = new node;
|
||||
(*curr).id = i;
|
||||
insert_one(first, curr);
|
||||
count++;
|
||||
std::cout << "招募了小人 #" << 1 << " , 它前面是 #" << (*(*curr).prev).id << " , 它后面是 #" << (*(*curr).next).id << std::endl;
|
||||
}
|
||||
|
||||
int counting = 0;
|
||||
@ -68,7 +70,7 @@ int main () {
|
||||
node* current = next_one;
|
||||
next_one = (*next_one).next;
|
||||
counting++;
|
||||
std::cout << "小人 #" << (*current).id << "数到了" << counting;
|
||||
std::cout << "小人 #" << (*current).id << " 数到了" << counting;
|
||||
if (counting == 3) {
|
||||
remove_one(current);
|
||||
counting = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user