#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int n, m;
vector<vector<string>>b;
bool cmp(vector<string>a, vector<string>b) {
return a[0] < b[0];
}
int main() {
int i, j;
cin >> n;
getchar();
b = vector<vector<string>>(n, vector<string>(6));
for (i = 0; i < 6 * n; i++) {
string a;
getline(cin, a);
b[i / 6][i % 6] = a;
}
sort(b.begin(), b.end(), cmp);
cin >> m;
for (i = 1; i <= m; i++) {
int num;
bool cheak;
string c;
cheak = false;
scanf("%d: ", &num);
getline(cin, c);
cout << num << ": " << c << endl;
if (num == 3) {
for (j = 0; j <= n - 1; j++) {
if (b[j][3].find(c)!=b[j][3].npos) {
cheak = true;
cout << b[j][0] << endl;
}
}
if(!cheak)
cout << "Not Found" << endl;
}
else {
for (j = 0; j <= n - 1; j++) {
if (b[j][num] == c) {
cheak = true;
cout << b[j][0] << endl;
}
}
if (!cheak)
cout << "Not Found" << endl;
}
}
return 0;
}
1022 Digital Library
最新推荐文章于 2024-09-09 23:37:48 发布