80分求调!!!!!!!!!
查看原帖
80分求调!!!!!!!!!
1368945
lihongruiv楼主2025/7/2 19:52
#include <bits/stdc++.h>
using namespace std;
struct node{
	int v;
	node *next;
};
int main(){
	node *head=new node({1,0});
	int n,x,y,z;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x>>y;
		if(x==1){
			cin>>z;
			node *p=head;
			while(p->v!=y&&p!=NULL){
				p=p->next;
			}
			node *s=new node({z,p->next});
			p->next=s;
		}else if(x==2){
			node *p=head;
			while(p->v!=y&&p!=NULL){
				p=p->next;
			}
			if(p->next==0){
				cout<<0;
			}else{
				cout<<p->next->v;
			}
			cout<<'\n';
		}else{
			node *p=head;
			while(p->v!=y&&p!=NULL){
				p=p->next;
			}
			p->next=p->next->next;
		}
	}
	return 0;
}
2025/7/2 19:52
加载中...