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

master^2
A.C.Sukazyo Eyre 2022-10-26 23:48:16 +08:00
parent 4ab54cbc2c
commit 0b60204e6b
Signed by: Eyre_S
GPG Key ID: C17CE40291207874
1 changed files with 4 additions and 2 deletions

View File

@ -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;