#include
int main()
{
int num_count=0,times=0;
int c=0,temp=0;
scanf("%d %d",&num_count,×);
temp=num_count; //将num_count暂存,后面备用
//定义数组,并赋值
int a[num_count];
while(num_count){
scanf("%d",&a[num_count-1]);
num_count--;
}
//输入times个数字判断是否在数组中
while(times){
num_count=temp; //重置num_count的值
scanf("%d",&c);
//判断c是否在数组中
while(num_count)
{
if (c==a[num_count-1])
printf("%d",num_count-1);
else
printf("-1");
num_count--;
}
times--;
}
}
取消
评论