解析:首先需要读取学生人数n,然后读取每个学生的座位号和学号。接着读取待查询的学生数m,然后读取每个待查询学生的学号。对于每个待查询的学生,查找其座位号并输出。 代码如下: ```cpp #include <iostream> #include <string> #include <vector> int main() { int n; std::cin >> n; std::vector<std::string> students(n); for (int i = 0; i < n; ++i) { std::cin >> students[i]; } int m; std::cin >> m; for (int i = 0; i < m; ++i) { std::string query; std::cin >> query; bool found = false; for (int j = 0; j < n; ++j) { if (students[j] == query) { std::cout << j + 1 << std::endl; found = true; break; } } if (!found) { std::cout << "na" << std::endl; } } return 0; } ``` [2024-10-18 23:44:53 | AI写代码神器 | 298点数解答]