本文共 312 字,大约阅读时间需要 1 分钟。
#includeconst int maxn = 100001;int hashTable[maxn] = { 0 };int main() { int n, m, x; scanf_s("%d %d", &n, &m); for (int i = 0; i < n; i++) { scanf_s("%d", &x); hashTable[x]++; } for (int i = 0; i < m; i++) { scanf_s("%d", &x); printf("%d\n", hashTable[x]); } return 0;}
输入:4 21 2 3 22输出:2输入:4输出:0
转载地址:http://fqddi.baihongyu.com/