![]()
#include<bits/stdc++.h>
using namespace std;
const int maxn=500;
int main(){
int n,m,L;
cin>>n>>m>>L;
int A[maxn][maxn];
int h[256]={0};
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>A[i][j];
h[A[i][j]]=h[A[i][j]]+1;
}
}
for(int k=0;k<L;k++){
cout<<h[k]<<" ";
}
}
这篇文章展示了如何使用C++编写一个程序,通过输入一个二维整数数组,利用哈希表(h)统计每个元素出现的次数,并在最后输出各元素的出现次数。
231

被折叠的 条评论
为什么被折叠?



