原题链接:https://www.luogu.com.cn/problem/P3156
解题思路:简单的数组题,唯一需要注意的是读写的数据量比较大,输入输出最好用scanf、printf
100分代码:
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int a[N], n, m;
int main()
{
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; i++) cin >> a[i];
int q;
while(m--)
{
scanf("%d", &q);
printf("%d\n", a[q]);
}
}
标签:P3156,线性表,int,洛谷题,scanf,printf,15 From: https://www.cnblogs.com/jcwy/p/18065352