博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c/c++查询M个数在N数组中出现的次数
阅读量:4034 次
发布时间:2019-05-24

本文共 312 字,大约阅读时间需要 1 分钟。

#include
const 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/

你可能感兴趣的文章
2020年终总结
查看>>
linux内核学习(4)建立正式内核的页式内存映射, 以x86 32位模式为例
查看>>
Homebrew指令集
查看>>
React Native(一):搭建开发环境、出Hello World
查看>>
React Native(二):属性、状态
查看>>
JSX使用总结
查看>>
React Native(四):布局(使用Flexbox)
查看>>
React Native(七):Android双击Back键退出应用
查看>>
Android自定义apk名称、版本号自增
查看>>
adb command not found
查看>>
Xcode 启动页面禁用和显示
查看>>
【剑指offer】q50:树中结点的最近祖先
查看>>
二叉树的非递归遍历
查看>>
【leetcode】Reorder List (python)
查看>>
【leetcode】Linked List Cycle (python)
查看>>
【leetcode】Linked List Cycle (python)
查看>>
【leetcode】Word Break(python)
查看>>
【剑指offer】面试题26:复杂链表的复制
查看>>
【leetcode】Candy(python)
查看>>
【leetcode】Clone Graph(python)
查看>>