#include<stdio.h>
#include<stdlib.h> //malloc(),free()头文件为stdlib.h
struct student
{
int studynumber;
struct student *next;
}; //别忘了分号
typedef struct student s_data;
s_data *p;
s_data *head;
s_data *newdata;
int main(){
int total, asktime,n,i,j; //变量使用前需声明(C语言)
head=(s_data*)malloc(sizeof(s_data));
p=head;
p->next=NULL;
scanf("%d%d",&total,&asktime);
for(i=0;i<total;i++) //建立链表
{
newdata=(s_data*)malloc(sizeof(s_data));
scanf("%d",newdata->studynumber);
p->next =newdata;
newdata->next =NULL;
p=newdata;
}
p=head;
for(i=0;i<asktime;i++){ //查询第n个进入时顺序遍历取第n个的学号
scanf("%d",&n); //n表示第n个进入教室
for(j=0;j<n;j++)
{
p=p->next ;
}
printf("%d",p->studynumber);
}
return 0;
}