#include<bits/stdc++.h>
using namespace std;
struct Node{
int id;
string title;
string author;
string keys;
string publisher;
int pubyear;
};
int main()
{
//freopen("in.txt","r",stdin);
int n;cin>>n;vector<Node> ppp;ppp.resize(n);
for(int i=0;i<n;i++){
cin>>ppp[i].id;getchar();
getline(cin,ppp[i].title);
getline(cin,ppp[i].author);
getline(cin,ppp[i].keys);
getline(cin,ppp[i].publisher);
cin>>ppp[i].pubyear;
}
int m;cin>>m;getchar();
for(int i=0;i<m;i++){
string temp;
getline(cin,temp);
cout<<temp<<endl;
int t=temp[0]-'0';
temp=temp.substr(3,temp.length());
vector<int> tt;
if(t==1){
for(int j=0;j<n;j++){
if(ppp[j].title==temp){
tt.push_back(ppp[j].id);
}
}
if(tt.size()!=0){
sort(tt.begin(),tt.end());
for(int j=0;j<tt.size();j++){
printf("%07d\n",tt[j]);
}
}else{
cout<<"Not Found"<<endl;
}
}else if(t==2){
for(int j=0;j<n;j++){
if(ppp[j].author==temp){
tt.push_back(ppp[j].id);
}
}
if(tt.size()!=0){
sort(tt.begin(),tt.end());
for(int j=0;j<tt.size();j++){
printf("%07d\n",tt[j]);
}
}else{
cout<<"Not Found"<<endl;
}
}else if(t==4){
for(int j=0;j<n;j++){
if(ppp[j].publisher==temp){
tt.push_back(ppp[j].id);
}
}
if(tt.size()!=0){
sort(tt.begin(),tt.end());
for(int j=0;j<tt.size();j++){
printf("%07d\n",tt[j]);
}
}else{
cout<<"Not Found"<<endl;
}
}else if(t==5){
for(int j=0;j<n;j++){
if(to_string(ppp[j].pubyear)==temp){
tt.push_back(ppp[j].id);
}
}
if(tt.size()!=0){
sort(tt.begin(),tt.end());
for(int j=0;j<tt.size();j++){
printf("%07d\n",tt[j]);
}
}else{
cout<<"Not Found"<<endl;
}
}else if(t==3){
for(int j=0;j<n;j++){
if(ppp[j].keys.find(temp)!=string::npos){
tt.push_back(ppp[j].id);
}
}
if(tt.size()!=0){
sort(tt.begin(),tt.end());
for(int j=0;j<tt.size();j++){
printf("%07d\n",tt[j]);
}
}else{
cout<<"Not Found"<<endl;
}
}
tt.clear();
}
return 0;
}
1022 Digital Library
猜你喜欢
转载自blog.csdn.net/csg3140100993/article/details/82053722
今日推荐
周排行