CSP202104-1 灰度直方图
1 // 2 // main.cpp 3 // CSP202104-1 灰度直方图 4 // 5 // Created by sylvia on 2021/11/8. 6 // Copyright © 2021 apple. All rights reserved. 7 // 8 9 #include <iostream> 10 #include <algorithm> 11 #include <string.h> 12 using namespace std; 13 #define M 256+5 14 int a[M]; 15 int n,m,l,x; 16 17 int main(){ 18 cin>>n>>m>>l; 19 memset(a,0,sizeof(a)); 20 for (int i=1;i<=n;i++){ 21 for (int j=1;j<=m;j++){ 22 cin>>x; 23 a[x]++; 24 25 } 26 } 27 for (int i=0;i<=l-1;i++){ 28 cout<<a[i]<<' '; 29 } 30 31 return 0; 32 }