栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 3214 Bussiness Rules Mana...

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 3214 Bussiness Rules Mana...

#include<iostream>#include<cstring>#include<cstdio>#include<map>#include<stdlib.h>using namespace std;map<string,int> fx;struct node{char name[30];int youxiandu;node *next;} *h;void tianjia(char e[30],int youxian){node *p,*q;p=(node*)malloc(sizeof(node));q=h;while(q->next!=NULL&&q->next->youxiandu>youxian)q=q->next;p->next=q->next;strcpy(p->name,e);p->youxiandu=youxian;q->next=p;}void shanchu(char e[30]){node *p,*q;p=q=h;while(strcmp(e,q->name)!=0){p=q;q=q->next;}p->next=q->next;free(q);}void quchu(){node *p;if(h->next==NULL)printf("<empty>n");else{p=h->next;h->next=p->next;printf("%sn",p->name);free(p);}}int main (){char ss[30],pp;int n,m,i,j,a,b,p,q,s,f,N,K;scanf("%d",&N);for(K=0;K<N;K++){h=(node *)malloc(sizeof(node));h->next=NULL;scanf("%d%*c",&n);for(i=0;i<n;i++){scanf("%s%d%*c",ss,&p);fx[ss]=p;}scanf("%d%*c",&m);for(int S=0;S<m;S++){scanf("%c%*c",&pp);if(pp=='a'){scanf("%s%*c",ss);tianjia(ss,fx[ss]);}if(pp=='g'){quchu();}if(pp=='d'){scanf("%s%*c",ss);shanchu(ss);}}}}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/374506.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号