没有AC,原因分析:对于head的处理应该放在最后
//版本二
ListNode*removeElements(ListNode* head, int val)
{
if(!head)
return head;
ListNode* p=head;
if(head->val==val)
head=head->next;
while(p->next!=NULL)
{
if(p->next->val==val)
p->next=p->next->next;
else
p=p->next;
}
return head;
}