This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

30
TangDou/XiTi/1397.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
//输入+输出重定向
//freopen("../x.in", "r", stdin);
//freopen("../x.out", "w", stdout);
int n;
scanf("%d", &n);
unordered_map<int, int> _map;
for (int i = 1; i <= n; ++i) {
int c;
scanf("%d", &c);
_map[c] = i; //key:个数,value:位置
}
int q;
scanf("%d", &q);
for (int i = 0; i < q; ++i) {
int m;
scanf("%d", &m);
if (_map.count(m) > 0) printf("%d\n", _map[m]);
else printf("%d\n", 0);
}
//关闭文件
//fclose(stdin);
//fclose(stdout);
return 0;
}