C. [GESP]L5-202603-Q3866-S
[GESP]L5-202603-Q3866-S
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
下面函数用“哑结点”统一处理删除单向链表中的头结点与中间结点。横线处应填( )。
struct Node{
int val;
Node* next;
Node(int v):val(v),next(nullptr){}
};
Node* eraseAll(Node* head, int x){
Node dummy(0);
dummy.next = head;
Node* cur = &dummy;
while(cur->next){
if(cur->next->val == x){
Node* del = cur->next;
________
delete del;
}else cur = cur->next;
}
return dummy.next;
}
{{ select(1) }}
cur = cur->next;cur->next = del->next;del->next = cur->next;cur->next = nullptr;
GESP 2026.03 C++ 五级 全真模拟赛
- 状态
- 已结束
- 规则
- OI
- 题目
- 27
- 开始于
- 2026-11-20 13:34
- 结束于
- 2026-11-25 13:34
- 持续时间
- 2 小时
- 主持人
- 参赛人数
- 0