//C++使用map实现学生查询 //映射关系为:学号-->学生所有信息 #include #include #include #include

using namespace std;

int main() { int m, n; string str; scanf("%d", &m); for(int i = 0; i < m; ++i) { map<string, string> student; scanf("%d", &n); getchar(); //注意这里必须要用getchar()吃掉回车! while(n--){ getline(cin, str); int pos = str.find(" "); student[str.substr(0, pos)] = str; } getline(cin, str); cout << student[str] << endl; } return 0; }