添加了初始化 log, 修复了第一个小人的 id 不对的问题

This commit is contained in:
A.C.Sukazyo Eyre 2022-10-26 23:48:16 +08:00
parent 4ab54cbc2c
commit 0b60204e6b
Signed by: Eyre_S
GPG Key ID: C17CE40291207874

View File

@ -50,16 +50,18 @@ int main () {
} }
node* first = new node; node* first = new node;
(*first).id = 0; (*first).id = 1;
(*first).prev = first; (*first).prev = first;
(*first).next = first; (*first).next = first;
int count = 1; int count = 1;
std::cout << "招募了小人 #" << 1 << " ." << std::endl;
for (int i = 2; i <= n; i++) { for (int i = 2; i <= n; i++) {
node* curr = new node; node* curr = new node;
(*curr).id = i; (*curr).id = i;
insert_one(first, curr); insert_one(first, curr);
count++; count++;
std::cout << "招募了小人 #" << 1 << " , 它前面是 #" << (*(*curr).prev).id << " , 它后面是 #" << (*(*curr).next).id << std::endl;
} }
int counting = 0; int counting = 0;
@ -68,7 +70,7 @@ int main () {
node* current = next_one; node* current = next_one;
next_one = (*next_one).next; next_one = (*next_one).next;
counting++; counting++;
std::cout << "小人 #" << (*current).id << "数到了" << counting; std::cout << "小人 #" << (*current).id << " 数到了" << counting;
if (counting == 3) { if (counting == 3) {
remove_one(current); remove_one(current);
counting = 0; counting = 0;