1022. Digital Library (30)PAT甲级
来源:互联网 发布:台湾用大陆网络语言 编辑:程序博客网 时间:2024/06/16 14:43
传送门
#include<iostream>#include<set>#include<map>#include<string> using namespace std;map<string,set<int> >mptitle,mpauthor,mpkeywords,mppub,mpyear;void query(map<string,set<int> > &mp,const string &temp){ if(mp.find(temp)==mp.end()) printf("Not Found\n"); else{ for(set<int>::iterator it=mp[temp].begin();it!=mp[temp].end();it++){ printf("%07d\n",*it); } }}int main(){ int n,id,m,type; string title,author,key,pub,year; cin>>n; for(int i=0;i<n;i++){ cin>>id; getchar(); getline(cin,title); mptitle[title].insert(id); getline(cin,author); mpauthor[author].insert(id); while(cin>>key){ mpkeywords[key].insert(id); char c=getchar(); if(c=='\n') break; } getline(cin,pub); mppub[pub].insert(id); getline(cin,year); mpyear[year].insert(id); } string temp; cin>>m; for(int i=0;i<m;i++){ scanf("%d: ",&type); getline(cin,temp); cout<<type<<": "<<temp<<endl; if(type==1) query(mptitle,temp); else if(type==2) query(mpauthor,temp); else if(type==3) query(mpkeywords,temp); else if(type==4) query(mppub,temp); else query(mpyear,temp); }}
0 0
- 【PAT甲级】1022. Digital Library (30)
- 1022. Digital Library (30)PAT甲级
- PAT甲级练习1022. Digital Library (30)
- PAT甲级1022. Digital Library (30)
- PAT 甲级 1022. Digital Library (30)
- [PAT-甲级]1022.Digital Library
- 1022. Digital Library (30)-PAT甲级真题
- PAT甲级练习题A1022. Digital Library (30)
- PAT 甲级 1022. Digital Library(map,读取标准输入)
- PAT 1022. Digital Library (30)
- pat 1022. Digital Library (30)
- PAT 1022. Digital Library (30)
- PAT 1022. Digital Library (30)
- PAT 1022. Digital Library (30)
- 【PAT】1022. Digital Library (30)
- [pat]1022. Digital Library (30)
- 1022. Digital Library (30)-PAT甲级真题(map映射)
- pat 1022. Digital Library
- 有关各种居中的问题总结:
- 长假后快速进入工作状态
- 蓝桥杯-十六进制转八进制
- 最长公共子序列(LCS)
- 赞!VC++编程学会使用D与R版通用调试输出功能,方便排错。
- 1022. Digital Library (30)PAT甲级
- The Letter Carrier's Rounds(UVa 814)
- stm32 移植cJson 注意free释放内存!!
- Download~!(南邮CTF)
- 【LeetCode】Container With Most Water
- ViewAnimator类及其子类的介绍
- java一条for循环打印多维数组
- UVA10954 :Add All(全部相加)
- [LeetCode]230. Kth Smallest Element in a BST