RE求调
马蜂良好
#include <bits/stdc++.h>
using namespace std;
struct Node{
int s;
Node *next;
};
Node *head,*r,*p;
int a,b,c,n;
void j(){
head=new Node;
r=head;
}
void li(){
p=new Node;
p->next=NULL;
r->next=p;
r=p;
}
void sh(){
p=head->next;
while(1){
if(p->s==b){
if(p->next==NULL){
cout<<0;
break;
}
else{
Node *l;
l=p;
l=l->next;
p->next=l->next;
l->next=NULL;
break;
}
}
p=p->next;
}
}
void ch(){
p=head->next;
while(1){
if(p->s==b){
cout<<p->s<<endl;
break;
}
p=p->next;
}
}
void add(){
p=head->next;
while(1){
if(p->s==b){
Node *l=new Node;
l->next=p->next;
p=l;
}
p=p->next;
}
}
int main(){
cin>>a>>b;
if(a==1) cin>>c;
li();
switch(a){
case 1:add();
case 2:ch();
case 3:sh();
}
return 0;
}