求救(TLE)必关
查看原帖
求救(TLE)必关
1459008
Yangzikun1125楼主2025/1/19 09:54
#include <iostream>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int x;
int y;
int main ()
{
 	cin>>x;
 	int ball[x];
 	for (int i=0;i<x;i++)
 	{
 		cin>>ball[i];
	}
	cin>>y;
	int loca[y];
	for (int i=0;i<y;i++)
	{
		cin>>loca[i];
	}
	int is[y];
	for (int i=0;i<y;i++)
	{
		for (int j=0;j<x;j++)
		{
			if(loca[i]==ball[j])
			{
				is[i]=j+1;
				break;
			}
			else
			{
				is[i]=0;
			}
		}
	}
	for (int i=0;i<y;i++)
	{
		cout<<is[i]<<endl;
	}
	return 0;
}


2025/1/19 09:54
加载中...