题解
2023-07-06 13:32:43
发布于:上海
35阅读
0回复
0点赞
# include<iostream>
using namespace std;
struct node{
int data;
node *next;
};
int main(){
int n,m,t,s=0,y;
node *head,*r,*p;
cin>>n>>m;
head=new node;
head->next=NULL;
r=head;
for(int i=0;i<n;++i){
cin>>t;
p=new node;
p->data=t;
p->next=NULL;
r->next=p;
r=p;
}
for(int i=0;i<m;++i){
cin>>t;
p=head;
while(p->next->data!=t) p=p->next;
p->next=p->next->next;
}
cin>>y;
p=head;
while(p->next->data!=y){
++s;
p=p->next;
}
cout<<s+1;
return 0;
}
这里空空如也
有帮助,赞一个