P3156. 询问学号

考点

  • 模拟

题解

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n, m, tmp;
cin >> n >> m;
vector<int> v;
while (n--)
{
cin >> tmp;
v.emplace_back(tmp);
}
while (m--)
{
cin >> tmp;
cout << v[tmp - 1] << endl;
}
return 0;
}

思路

直接拿vector存储即可